Commands to Check the Unix, Linux Swap Size & Utilization

You are looking for the command to figure out the swap space size and the utilization. You are at the right place! 🙂

There are many commands, in which you can execute. Do refer them as below,

swapon Command

# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-0                               partition       20971516        16904   -1

/proc/swaps Command

# more /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/dm-0                               partition       20971516        16904   -1

# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/dm-0                               partition       20971516        16904   -1

free -m/h/g Command

# free -m
              total        used        free      shared  buff/cache   available
Mem:          31918       14332        4184        8509       13400        8613
Swap:         20479          16       20463

top Command

# top
top - 11:52:23 up 119 days,  7:13,  1 user,  load average: 0.26, 0.41, 0.40
Tasks: 398 total,   1 running, 397 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.2 us,  0.0 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem : 31918.30+total, 4186.164 free, 14331.21+used, 13400.93+buff/cache
MiB Swap: 20479.99+total, 20463.48+free,   16.508 used. 8615.172 avail Mem

/proc/meminfo Command

# grep Swap /proc/meminfo
SwapCached:         1440 kB
SwapTotal:      20971516 kB
SwapFree:       20954612 kB

vmstat Command

# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0  16904 4282516   5360 13717796    0    0     0     4    0    0  2  0 97  0  0

You May Also Like

Leave a Reply?