The free command in Linux

free prints the system memory picture: total, used, free, cache and — the number that matters — available, the kernel's estimate of memory that could be handed to applications right now. Most "Linux ate my RAM" panics dissolve the moment you read the available column instead of free.

How free works

free is a formatter over /proc/meminfo, the kernel's memory ledger. The column that matters, "available", is not a simple subtraction: it is the kernel's own estimate (MemAvailable) of how much could be handed to applications without swapping, accounting for reclaimable cache and the minimum watermarks it will defend.

The mental model behind the numbers: Linux treats free RAM as wasted RAM and fills it with page cache — files read once are kept around in case they are needed again. This cache is why the second launch of anything is faster, and why "used" looks alarming to newcomers. Pressure shows elsewhere: shrinking available, growing swap activity, and processes dying by OOM-killer in the journal.

Syntax

free [OPTIONS]

Common options

OptionWhat it does
-hHuman-readable units.
-m / -gFixed units: MiB / GiB.
-s NRefresh every N seconds.
-tAdd a total line (RAM + swap).

How to use free: examples

$ free -h

The standard invocation. Judge pressure by "available", not "free".

$ free -h -s 2

Live view while you load-test something.

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

Extract just available memory for a monitoring script.

Real-world use cases for free

Sizing before deploying

Will the new service fit? free -h for available, minus the service's expected RSS, keeping headroom for cache. Deploying into insufficient available is how you meet the OOM-killer at 4am.

Explaining "Linux ate my RAM"

A teammate panics at 95% used: walk them through free -h — the gap between used and available is cache doing its job. The teachable moment that prevents a dozen future false alarms.

Pro tips and common mistakes

Frequently asked questions about free

Used looks huge and free tiny — is that bad?

Usually healthy: the difference is disk cache, reclaimed on demand. Trouble is signalled by low available plus growing swap usage.

When is swap usage a problem?

Some long-idle pages in swap are fine. Continuous swap in/out traffic (see vmstat 1) while available is exhausted means real memory pressure — and everything will feel slow.

How much RAM does one process use?

ps aux sorted by %MEM, or top/htop. RSS is resident RAM; VSZ counts virtual mappings and overstates reality.

Related commands

ps

See what is running, find a process ID, and combine with grep to hunt down a program.

df & du

See free space per filesystem and find what is eating your disk, directory by directory.

top & htop

The live dashboard: CPU, memory, load average and the processes consuming them.

Want to build real fluency? The interactive course takes you through free and every other essential command with guided, checked exercises.