In Linux there are different types of commands to check memory usage. In this blog we are going to discuss about some of the commands to check memory size.
The /proc/meminfo containing a summary of how the kernel is managing its memory. The same file is used by free and other utilities 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.
The free command provides information about unused and used memory and swap space on Linux or another Unix-like operating system.
Memory consists of mainly random access memory (RAM). Swap space is is a portion of a hard disk drive (HDD) that is used to simulate additional main memory (i.e., which is used for virtual memory).
vmstat collects and displays summary information about memory, processes, interrupts, paging and block I/O. Users of vmstat can specify a sampling interval which permits observing system activity in near-real time.
- Procs – r: Total number of processes waiting to run
- Procs – b: Total number of busy processes
- Memory – swpd: Used virtual memory
- Memory – free: Free virtual memory
- Memory – buff: Memory used as buffers
- Memory – cache: Memory used as cache.
- Swap – si: Memory swapped from disk (for every second)
- Swap – so: Memory swapped to disk (for every second)
- IO – bi: Blocks in. i.e blocks received from device (for every second)
- IO – bo: Blocks out. i.e blocks sent to the device (for every second)
- System – in: Interrupts per second
- System – cs: Context switches
- CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time
Top is a task manager program in many Unix-like operating systems. It produces an ordered list of running processes selected by user-specified criteria, and updates it periodically.It can sort the tasks by CPU usage, memory usage and runtime.
AT Computing’s System & Process Monitor.The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on system level, i.e. cpu, memory, disk and network.
The program htop is an interactive process viewer. It is similar to top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines.
By default, the htop command is not installed on most Linux distributions.
GUI tool to see memory usage
The “Gnome System Monitor” application displays the basic system information and monitor system processes graphically. You can use System Monitor to modify the behavior of the system. You can start System Monitor clicking System menu > Administration > System Monitor. Or type the following command in shell prompt.
[root@TTS ~]# gnome-system-monitor