« Back to System information

Show memory information on OpenBSD

This article has last been updated on .

Finding memory information and usage on OpenBSD requires a few commands and the right places to look. If you are used to Linux, then commands like free are no longer available. Let’s have a look at memory details on OpenBSD.

Memory capacity

One of the easiest methods to find the memory sizes is by using the output of dmesg, which will include hardware information. Filter out the lines that are related to memory and the total and available amount of memory will be displayed.

# dmesg | grep -i mem
real mem = 1056952320 (1007MB)
avail mem = 998526976 (952MB)

Another option is using sysctl and retrieve the key hw.physmem to find the

# sysctl hw.physmem
hw.physmem=1056952320

Memory usage

# top -d 1
load averages:  0.11,  0.09,  0.08    mail.example.org 14:09:32
58 processes: 1 running, 56 idle, 1 on processor  up 11 days 02:14:21
CPU states:  0.0% user,  0.0% nice,  0.1% sys,  0.0% spin,  0.9% intr, 99.0% idle
Memory: Real: 286M/623M act/tot Free: 338M Cache: 192M Swap: 9296K/1264M

  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
56989 _rspamd    2    0  114M   93M sleep     kqread   11:27  0.00% rspamd
91511 _redis     2    0   18M 4588K sleep     kqread    7:34  0.00% redis-server
 1803 _rspamd    2    0   98M   79M sleep     kqread    6:58  0.00% rspamd
33019 _unwind    2    0   16M   21M sleep     kqread    2:48  0.00% unwind
51184 _rspamd    2    0   62M   29M sleep     kqread    2:06  0.00% rspamd
70802 www        2    0 2488K 5536K idle      kqread    0:56  0.00% httpd
83309 www        2    0 2508K 5520K idle      kqread    0:55  0.00% httpd
29351 www        2    0 2504K 5532K idle      kqread    0:54  0.00% httpd
94015 root       2    0   48M 5560K sleep     kqread    0:29  0.00% rspamd
19307 _ntp       2  -20 1172K 1248K sleep     kqread    0:12  0.00% ntpd
81934 james     28    0 1888K 3252K run       -         0:09  0.00% sshd-session
31135 _pflogd    4    0 1016K  928K sleep     bpf       0:07  0.00% pflogd
25823 _unbound   2    0   13M   13M idle      kqread    0:07  0.00% unbound
73436 _unwind    2    0 2492K 3484K idle      kqread    0:06  0.00% unwind
18631 root       2    0 1140K 1124K idle      kqread    0:04  0.00% cron
 3003 _syslogd   2    0 1492K 1460K sleep     kqread    0:03  0.00% syslogd
76375 _smtpd    10    0   46M 4740K sleep     thrslee   0:03  0.00% filter-senderscore
28284 _smtpd     2    0 5120K 7896K idle      kqread    0:01  0.00% smtpd

Feedback

Small picture of Michael Boelen

This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

Mastodon icon

Related articles

Like to learn more? Here is a list of articles within the same category or having similar tags.