How to check which process is using more memory in Linux Ubuntu. 3 commands on Linux to check memory size. From the free memory in Linux, to Linux memory usage by process and Linux memory usage percentage, these commands display all the relevant information. Read along:
free
free – Display amount of free and used memory in the system. free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gathered by parsing /proc/meminfo.
The displayed columns are:
total – Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
used – Used memory (calculated as total – free – buffers – cache)
free – Unused memory (MemFree and SwapFree in /proc/meminfo)
shared –Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on kernels 2.6.32, displayed as zero if not available)
buffers – Memory used by kernel buffers (Buffers in /proc/meminfo)
cache – Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
buff/cache –Sum of buffers and cache
available –Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)
top
top – display Linux processes – uptime and load averages, task and cpu states and memory usage. The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel.
The types of system summary information shown and the types, order and size of information displayed for processes are all user configurable and that configuration can be made persistent across restarts. The program provides a limited interactive interface for process manipulation as well as a much more extensive interface for personal configuration — encompassing every aspect of its operation.
vmstat -m
vmstat displays virtual memory statistics. vmstat 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.