Linux comes with different command to check memory usage. free command displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
vmstat command reports information about processes, memory, paging, block IO, traps, and cpu activity.
Then you can use top command which provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.
free command
Display free memory size in MB:
$ free -mOutput:
total used free shared buffers cached
Mem: 750 625 125 0 35 335
-/+ buffers/cache: 254 496
Swap: 956 0 956
Displays a line containing the totals memory in MB:
$ free -t -m
Output:
total used free shared buffers cached
Mem: 750 625 125 0 35 335
-/+ buffers/cache: 253 496
Swap: 956 0 956
Total: 1707 625 1082
vmstat command
Type vmstat command at shell prompt:
$ vmstatOutput:
-----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 131620 35432 341496 0 0 42 82 737 1364 15 3 81 1
top command
Type top command at shell prompt:
$ top
To exit from top command type q key.
Read man page of free, vmstat, top command for complete information.