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).
freefree -h — Show memory usage in human-readable format (auto-select KB/MB/GB).
free -hfree -m — Show memory usage in mebibytes (MiB).
free -mfree -g — Show memory usage in gibibytes (GiB).
free -gfree -b — Show memory usage in bytes.
free -bfree --si — Use SI units (powers of 1000 instead of 1024).
free -h --siDisplay Options
free -t — Show a total line (RAM + swap combined).
free -htfree -w — Wide output: show buffers and cache as separate columns.
free -whfree -l — Show low and high memory statistics (32-bit systems).
free -lhfree -v — Show version information.
free -vContinuous Monitoring
free -s <seconds> — Repeat the output every n seconds continuously.
free -h -s 5free -c <count> -s <seconds> — Repeat the output n times with a delay between each.
free -h -c 10 -s 2watch free -h — Use watch for a refreshing display (alternative to -s).
watch -n 2 free -hOutput 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 -20cat /proc/meminfo | grep -i huge — Check huge pages configuration and usage.
cat /proc/meminfo | grep -i hugevmstat -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