
If you are using a system and would like to determine its physical memory without physically checking, you can use the command line.There are number of programs, tools, and utilities which you can use to examine the memory status of your system. This article talks about the frequently used 3 commands.
The top command provides a dynamic, real-time view of a running system. Included in that system summary is the ability to check memory usage on a per-process basis.
Bonus Tip: top -o %MEM This memory friendly command will sort all processes by memory used.
The free command is the most simple and easy to use and check memory usage on linux. The free command outputs:
Bonus Tip: To show the memory unit to human-readable format free -h
The/proc/meminfo is used by to report the amount of free and used memory (both physical and swap) on the system as well as the shared memory and buffers used by the kernel. You can use the cat or less to dispaly the vales.
Example: cat /proc/meminfo
To list top 10 Memory consuming processes with user.
ps -e -o pmem,pid,user,args|sort -k1 -nr|head -10
Find out the top 10 memory consuming process.
ps -auxf|sort -nr -k4|head -10
Virtual memory statistics reporter command.
vmstat -s