Main Menu

Search

Linux: How To Check Free Memory, Total & Used Memory on Linux Machines? ("free", "top", "vmstat", "/proc/meminfo" commands)

Below 4 commands can be used to check Free Memory, Total & Used Memory on Linux Machines.

free
top -n 1 -b | egrep "Mem|Swap"
vmstat -s | grep -i memory
 cat /proc/meminfo | egrep "Mem|Cache|Swap"

Below are sample outputs of above commands.


# free


              total        used        free      shared  buff/cache   available
Mem:        3780272     1347692     2158304        8708      274276     1584088
Swap:       4194300           0     4194300

# top -n 1 -b | egrep "Mem|Swap"


KiB Mem :  3780272 total,  2157760 free,  1348236 used,   274276 buff/cache
KiB Swap:  4194300 total,  4194300 free,        0 used.  1583544 avail Mem

# vmstat -s | grep -i memory


      3780272 K total memory
      1347820 K used memory
       137472 K active memory
        49832 K inactive memory
      2158168 K free memory
         4172 K buffer memory

# cat /proc/meminfo | egrep "Mem|Cache|Swap"


 MemTotal:        3780272 kB
MemFree:         2158168 kB
MemAvailable:    1583992 kB
Cached:            87324 kB
SwapCached:            0 kB
SwapTotal:       4194300 kB
SwapFree:        4194300 kB


Products to which Article Applies

All Linux environments

Additional References


https://www.binarytides.com/linux-command-check-memory-usage/


https://www.linux.com/tutorials/5-commands-checking-memory-usage-linux/

 

tarun boyella

No comments:

Post a Comment