free — Show RAM and Swap Memory Usage

Practical guide to free: display RAM and swap usage and learn why on Linux the available column matters more than free.

free gives you a snapshot of your Linux system's memory usage in seconds: how much physical RAM and swap are in use and – most importantly – how much memory is actually available for new programs. The classic beginner mistake is panicking at a low free column. This guide walks you through the key options and explains why, on Linux, the column that matters is available, not free.

Basic Usage

free — Show memory usage in kibibytes (default).

free

free -h — Show memory usage in human-readable format (auto-select KB/MB/GB).

free -h

free -m — Show memory usage in mebibytes (MiB).

free -m

free -g — Show memory usage in gibibytes (GiB).

free -g

free -b — Show memory usage in bytes.

free -b

free --si — Use SI units (powers of 1000 instead of 1024).

free -h --si

Display Options

free -t — Show a total line (RAM + swap combined).

free -ht

free -w — Wide output: show buffers and cache as separate columns.

free -wh

free -l — Show low and high memory statistics (32-bit systems).

free -lh

free -v — Show version information.

free -v

Continuous Monitoring

free -s <seconds> — Repeat the output every n seconds continuously.

free -h -s 5

free -c <count> -s <seconds> — Repeat the output n times with a delay between each.

free -h -c 10 -s 2

watch free -h — Use watch for a refreshing display (alternative to -s).

watch -n 2 free -h

Output Columns Explained

total — Total installed memory (or total swap space).

free -h | awk '/Mem:/ {print $2}'

used — Memory actively in use by processes (total - free - buffers - cache).

free -h | awk '/Mem:/ {print $3}'

free — Memory not being used at all (completely unused).

free -h | awk '/Mem:/ {print $4}'

shared — Memory used by tmpfs and shared memory segments.

free -h | awk '/Mem:/ {print $5}'

buff/cache — Memory used for disk buffers and page cache (reclaimable by the kernel).

free -h | awk '/Mem:/ {print $6}'

available — Estimated memory available for new applications (without swapping). This is the most useful metric.

free -h | awk '/Mem:/ {print $7}'

Common Patterns

free -h | awk '/Mem:/ {print $7}' — Show only the available memory.

free -h | awk '/Mem:/ {print "Available: " $7}'

free -h | awk '/Mem:/ {printf "Used: %s / %s (%.1f%%)\n", $3, $2, $3/$2*100}' — Show memory usage as a percentage.

free -m | awk '/Mem:/ {printf "RAM: %.1f%% used\n", $3/$2*100}'

free -h | awk '/Swap:/ {print $3}' — Check how much swap is being used.

free -h | awk '/Swap:/ {print "Swap used: " $3}'

free -m | awk '/Mem:/ {if ($7 < 500) print "WARNING: Low memory!"}' — Alert if available memory drops below a threshold (MB).

free -m | awk '/Mem:/ {if ($7 < 500) print "WARNING: Only " $7 "MB available!"}'

cat /proc/meminfo — Show detailed memory information from the kernel (more granular than free).

cat /proc/meminfo | head -20

cat /proc/meminfo | grep -i huge — Check huge pages configuration and usage.

cat /proc/meminfo | grep -i huge

vmstat -s — Show detailed memory statistics in a different format.

vmstat -s | head -10

Conclusion

free is a pure read-only command with no risk – you can run it any time without worrying. The key takeaway: don't panic at a low free column. Linux deliberately uses spare RAM as a page cache to speed up disk access, and it reclaims that memory instantly the moment applications need it. The honest answer to "how much memory do I have left?" lives in the available column, not in free. For a continuous live view, reach for free -s or watch; for deeper analysis, turn to vmstat, top or htop. Note that macOS has no free – there, vm_stat provides comparable information.

Further Reading

  • free(1) man page – the official procps-ng manual page for free
  • Linux ate my RAM – the classic explanation of why a low “free” value is normal on Linux
  • top – interactive real-time process and memory monitor
  • htop – friendlier, colourful alternative to top with mouse support
  • vmstat – overview of memory, swap, I/O and CPU statistics