Free command is frontend to /proc/meminfo file. It provide more human readable output to show you the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel:
$ free -m
The vmstat, sar and iostat commands are the collection of package included in sysstat – the system monitoring tools. vmstat - Report virtual memory statistics. 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.
Type the following command:
FIELD DESCRIPTION FOR VM MODE
r: The number of runnable processes (running or waiting for run time).
b: The number of processes in uninterruptible sleep.
swpd: the amount of virtual memory used.
free: the amount of idle memory.
buff: the amount of memory used as buffers.
cache: the amount of memory used as cache.
inact: the amount of inactive memory. (-a option)
active: the amount of active memory. (-a option)
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).
in: The number of interrupts per second, including the clock.
cs: The number of context switches per second.
Two important fields are free under memory and si, so under swap column
- Free – Amount of free/idle memory spaces.
- si – Swapped in every second from disk in Kilo Bytes.
- so – Swapped out every second to disk in Kilo Bytes.
delay The delay between updates in seconds. If no delay is specified, only one report is printed with the average values since boot.
count Number of updates. In absence of count, when delay is defined, default is infinite.
Execute vmstat ‘X’ seconds and (‘N’ number of times)
$ vmstat 3 5
With this command, vmstat execute every 3 seconds and stop after executing 5 intervals.
-s, --stats Displays a table of various event counters and memory statistics. This display does not repeat.
$ vmstat -s
-S, --unit character Switches outputs between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes. Note this does not change the swap (si/so) or block
The vmstat displays in Megabytes with parameters -S and m. By default vmstat displays statistics in kilobytes.
$ vmstat -S m
-d, --disk Report disk statistics
$ vmstat -d