free
Processes and system
Usage
free -hCounts how much memory and swap are left on Linux; the column to read is available, not free, because cache is handed back on demand, and macOS has no free at all (use vm_stat).
Common flags
| Flag | Meaning |
|---|---|
| -h | Human units, so Gi and Mi instead of raw kibibytes. |
| -m / -g | Force mebibytes / gibibytes. |
| -s 5 | Repeat every five seconds until Ctrl+C. |
| -t | Add a total row for RAM plus swap. |
| -w | Wide output that separates buffers from cache. |
Examples
free -hRead the available column: that is what a new program can actually get.
free -m -s 5Watch memory every five seconds while a job runs.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does free do?
Counts how much memory and swap are left on Linux; the column to read is available, not free, because cache is handed back on demand, and macOS has no free at all (use vm_stat).
Q. How do I type it?
free -h — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
5 are listed here; the full set is in man free. This command sits under Processes and system.
Related commands
man page: man free