Home·Terminal commands

free

Processes and system

Usage

free -h

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).

Common flags

FlagMeaning
-hHuman units, so Gi and Mi instead of raw kibibytes.
-m / -gForce mebibytes / gibibytes.
-s 5Repeat every five seconds until Ctrl+C.
-tAdd a total row for RAM plus swap.
-wWide output that separates buffers from cache.

Examples

free -h

Read the available column: that is what a new program can actually get.

free -m -s 5

Watch 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