free Command Cheat Sheet
free gives a snapshot of the system's memory usage. It parses /proc/meminfo and displays total, used, free, shared, buffer, and swapped memory.
Synopsis
free [options]
Basic Usage
Standard Output
free
Output (in kilobytes by default):
total used free shared buff/cache available
Mem: 8106604 2125640 1568832 302456 4412132 5412520
Swap: 2097148 0 2097148
Understanding the Columns
Most confusion comes from "free" vs "available".
| Column | Meaning |
|---|---|
| total | Total installed RAM (excluding kernel reserved bits) |
| used | Memory currently in use by processes (total - free - buff/cache) |
| free | Completely unused memory (wasted RAM!) |
| shared | Memory used by tmpfs (shmem) |
| buff/cache | Memory used by kernel buffers and page cache |
| available | The most important number. Estimate of how much memory is available for starting new applications. |
Why is free so low? Linux caches accessed files in RAM to speed up performance. This memory is marked as buff/cache but can be instantly reclaimed if apps need it. Therefore, check available, not free.
Display Options
Human Readable (-h)
Uses standard suffixes (Ki, Mi, Gi - base 1024).
free -h
Output:
total used free shared buff/cache available
Mem: 7.7Gi 2.0Gi 1.5Gi 295Mi 4.2Gi 5.2Gi
Swap: 2.0Gi 0B 2.0Gi
SI Units (--si)
Uses power of 1000 (KB, MB, GB).
free -h --si
Specific Units
Force output in specific unit (numbers can be huge).
-b: bytes-k: kilobytes (default)-m: megabytes-g: gigabytes--tera: terabytes
free -m
Continuous Monitoring
Watch Mode (-s)
Run free continuously with a delay (seconds).
free -h -s 3
Ctrl+C to stop).
Repeated Count (-c)
Run N times and exit.
free -h -c 5 -s 1
Detailed View
Show Low/High Memory (-l)
Relevant for 32-bit systems with PAE or unusual architectures. Shows memory mapping.
free -l
Total Line (-t)
Adds a line at the bottom summing Physical RAM + Swap.
free -h -t
Total: 9.7Gi 2.0Gi
Troubleshooting High Memory Usage
- Check
available: If this is close to zero, your system will start Swapping. - Check
Swap used: If Swap is high and actively changing (thrashing), performance will tank. - Check
buff/cache: If this is high butavailableis also ok, this is healthy behavior. Do not try to "clear RAM" manually; let the kernel manage it.
Clearing Cache (For Testing Only)
If you really need to flush buffers (e.g., before a benchmark):
sudo sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
Exit Status
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error |
Comparison
free: Quick overview.vmstat: Memory + IO/CPU context.top: Per-process memory.cat /proc/meminfo: The raw, extremely detailed source.