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
top Command Reference: Flags, Batch Mode & CI ExamplesReference for top: -b batch mode, -n, -o, -d, the non-interactive logging pattern, and a CI example that capt…
df Command Reference: Flags, Usage & CI ExamplesReference for df: -h, -i, -T, --output, the disk-full diagnosis use, and a CI example that checks free space…
ps Command Reference: Flags, Usage & CI ExamplesReference for ps: aux, -ef, -o custom columns, --sort, and a CI example that lists running processes to debug…