Skip to content
Search

Free

lastmod 2023-02-07created 2019-06-134 edits

The free command is the most simple and easy to use command to check memory usage on linux.

Usage

You can also check it via /proc/meminfo.

$ free -m
             total       used       free     shared    buffers     cached
Mem:          7976       6459       1517          0        865       2248
-/+ buffers/cache:       3344       4631
Swap:         1951          0       1951

Fields

  • total - Total memory capacity
  • used - Amount of memory in use
  • free - Amount of available memory
  • shared - Amount of memory shared between processes
  • buffer - Amount of memory used for buffers. A cache that stores blocks such as file system metadata
  • cache - Amount of memory used for the page cache and slab (memory used by the kernel). The page cache caches file contents
  • avaliable - Estimated memory actually available. The free value plus the size of kernel memory areas that are released when memory runs low, including buffer cache, page cache, and other kernel memory

Available memory size

You can check the remaining memory size as follows.

$ free -m | grep Mem | awk '{print $7}'

Other way

Checking the /proc/meminfo file is also a good alternative. Other programs are listed below.

See also

author Zer0 sitemap