When to use free
Use free to inspect Linux memory accounting before deciding that a server is running out of memory. Cached data can often be reclaimed, so available memory is usually more informative than the unused value alone.
Syntax
free [PARAMETERS]Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
Check memory
free -hMemory and swap figures are shown in human-readable units.
Take three measurements
free -m -s 2 -c 3Three samples are collected at two-second intervals for a short comparison.
View exact bytes
free -bValues are reported in bytes for more precise capture.
Notes and limitations
- To estimate the memory reserve, see available, and not only free: part of the cache can be freed.
- Container data may reflect host memory; separately consider the limits cgroup.
Common questions and troubleshooting
Does a low free value prove memory exhaustion?
No. Linux uses spare RAM for cache. Inspect available memory, swap activity and application behaviour before drawing that conclusion.
Why do container limits differ from free output?
Host-wide accounting and container control-group limits can differ depending on environment and tool version. Inspect the container's actual resource limits.
Further help
Options vary by version and distribution. Check the installed documentation with this command: man free.