Skip to content
Latchkey

free Command Reference: Flags, Usage & CI Examples

free reports total, used, and available system memory.

free shows RAM and swap usage. In CI it diagnoses out-of-memory failures and confirms headroom before a step that builds or tests with a large heap.

Common flags and usage

  • -h: human-readable sizes
  • -m / -g: report in MiB / GiB
  • -s <secs>: refresh every N seconds
  • -t: add a total row (RAM + swap)
  • The "available" column estimates usable memory

Example

shell
free -h
free -h | awk '/Mem:/ {print "available:", $7}'

In CI

Read the "available" column, not "free": Linux uses spare RAM for cache, so "free" looks low while "available" reflects what a new process can actually use. Capturing free -h around an OOM-killed step confirms whether memory was the cause.

Key takeaways

  • free reports RAM and swap, total/used/available.
  • Trust "available" over "free" -- cache counts as reclaimable.
  • Capture free around a step to confirm OOM failures.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →