Linux: Show Free Memory

By Xah Lee. Date: . Last updated: .
linux memory free
linux free -h, show free memory.

free shows how much memory is free.

The same info is shown in top command. [see Linux: Monitor Processes: top]

The command htop shows a visual representation. [see Linux: Monitor Processes, htop]

linux htop 2017 01 02
Linux htop command.

Understanding Memory

Cache is disk data in RAM. Linux uses RAM as cache for file data (from hard-disk). (Because RAM's IO speed is a thousand times faster than hard disk, so OS will load disk data to RAM as cache)

Swap is the disk space used for virtual memory purposes. Linux uses non-volatile storage device (example: hard-disk, flash-memory) as virtual memory. The virtual memory on hard-disk is called swap space. Virtual memory means the perm storage is used as temp space for RAM. So, when your RAM is full, the OS can off-load parts of it currently not used data to disk, therefore free up memory for application that needs it.

Here's manual from man free:


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/mem‐ info. 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, dis‐ played 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 swap‐ ping. 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 ker‐ nels 2.6.27+, otherwise the same as free)

If you have a question, put $5 at patreon and message me.

Linux Shell Basics

  1. Get System Info
  2. Shell Basics
  3. grep, cat, awk, uniq
  4. sort
  5. find, xargs
  6. diff Files/Dir
  7. dir size: du
  8. dir tree
  9. tar gzip bzip2 xz 7zip rar zip
  10. wget, curl
  11. rsync
  12. Install Packages

Sys Admin

  1. Job Control
  2. ps
  3. top
  4. htop
  5. RAM stat
  6. Users and Groups
  7. File Permission
  8. Opened Files: lsof
  9. shutdown, sleep


  1. Bash/Terminal Keys
  2. Man Page Keys
  3. Bash Prompt Setup
  4. Bash Color Prompt
  5. .bashrc, .profile, .bash_profile
  6. Virtual Console
  7. Terminal Control Sequence Keys
  8. Ctrl+s Freeze vim
  9. Reset Terminal
  10. tmux
  11. Bash Manual in Chapters
  12. Bash Misc Tips
  13. Log Terminal Session

Linux Desktop

  1. Most Useful GUI Apps
  2. Set Default App
  3. Shell Commands for GUI Apps
  4. Image Viewers
  5. Music Players
  6. Move File to Trash by Command
  7. X11 Selection and Clipboard
  8. How to Switch to LXDE, Xfce
  9. LXDE Keys
  10. LXDE/Openbox, Change Keys
  11. LXDE Set Key Repeat Rate
  12. LXDE/OpenBox, Disable Mouse Scroll Wheel Hide Window
  13. Xfce Keys
  14. Xfce Good Themes
  15. xmonad Keybinding
  16. How to Restart X11
  17. Why Tiling Window Manager Sucks
  18. Standard Fonts
  19. How to Install Font