vmstat — Report Virtual Memory Statistics.Summary:
It is not very bad to use the swap space. But if too much of IO between RAM and Swap, then it is bad. To debug such conditions, we can use vmstat. It reports information about processes, memory, paging, block IO, traps, disks and CPU activity. The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case. Examples:
$ vmstat -- Show the VM stats. $ vmstat 6 -- Till the key Ctrl+C pressed, show the stats forevery 6 sec. $ vmstat 5 6 -- Show the stats for every 5 sec and 6 times. $ vmstat -a -- Show the active and inactive memory size. $ vmstat -f -- Show the no of forks since boot. $ vmstat -s -- Show the table of event and memory stats. $ vmstat -m -- Show kernel slab memory pool info. $ vmstat -Sk -- Show bytes size in KB.
Read: man vmstat