free - Check Memory Usage Easily
The free command displays the amount of free and used memory in the system. It provides information about RAM and swap usage, as well as buffers and caches used by the kernel.
Syntax
free [OPTIONS]
Description of Output Columns
| Column | Description |
|---|---|
total |
Total amount of memory (RAM or swap). |
used |
Memory used. This includes buffers and cache unless -/+ buffers/cache is shown. |
free |
Memory not used at all. |
shared |
Memory used (mostly) by tmpfs or shared between processes. |
buff/cache |
Memory used by the kernel buffers and page cache. |
available |
Estimated memory available for starting new applications (Linux ≥ 3.14). |
Note: The
availablememory gives a more accurate idea of how much memory is really available for applications.
Options
| Option | Description |
|---|---|
-h |
Human-readable output (e.g., in MB/GB). |
-m |
Show output in megabytes. |
-g |
Show output in gigabytes. |
-s <sec> |
Continuously display every <sec> seconds. |
-t |
Show total line. |
Practical Examples
1. Basic usage (default in kilobytes)
free
2. Human-readable format (best for general use)
free -h
Example Output:
total used free shared buff/cache available
Mem: 15Gi 4.2Gi 1.1Gi 1.0Gi 9.7Gi 9.7Gi
Swap: 2.0Gi 0B 2.0Gi
3. Show output in megabytes
free -m
4. Show output in gigabytes
free -g
5. Watch memory usage over time (every 5 seconds)
free -h -s 5
6. Include total line at the end
free -h -t
Practical Tip
If you’re wondering how much memory your apps can still use, focus on the available column, not just the free one. Linux uses free memory for cache to speed up the system, but it will release that cache if needed by applications.
For more info, check the man page:
man free