Master Linux Memory Monitoring with the free Command and Its Options
This guide explains how to use the Linux free command to display physical memory and swap usage, details each option’s meaning, and provides multiple examples—including human‑readable output, total summaries, periodic monitoring, and version checking—to help administrators monitor system resources effectively.
free: Display Memory Usage
Function Description
The free command shows the system's physical memory and swap partition capacities, as well as used, free, shared, buffered, and cached memory amounts.
Command Syntax
free [options]Option Meanings
The options are described below:
-b: display memory usage in bytes
-k: display memory usage in kilobytes
-m: display memory usage in megabytes
-g: display memory usage in gigabytes
-h: display memory information in a human‑readable format
-t: show total physical memory and swap capacity
-s: continuously monitor memory usage at specified intervals
-V: show version information
Reference Examples
Example 1
Human‑readable display of physical memory and swap capacity:
[root@cnLinuxer ~]# free -h
total used free shared buff/cache available
Mem: 1.8G 661M 471M 122M 685M 871M
Swap: 2.0G 0B 2.0GExplanation of free output fields:
Mem section:
total: total physical memory
used: memory currently used
free: memory not allocated
shared: total memory shared among processes
buff/cache: size of disk cache
available: memory available for applications
Swap section:
total: total swap space
used: used swap space
free: free swap space
Example 2
Display memory usage as totals:
[root@cnLinuxer ~]# free -t -h
total used free shared buff/cache available
Mem: 1.8G 661M 471M 122M 685M 871M
Swap: 2.0G 0B 2.0G
Total: 3.8G 661M 2.5GExample 3
Repeatedly print memory information:
# every 2 seconds until Ctrl+C
[root@cnLinuxer ~]# free -s 2
# every 3 seconds, print 5 times
[root@cnLinuxer ~]# free -s 3 -c5Example 4
Show version information:
[root@cnLinuxer ~]# free -V
free from procps-ng 3.3.10Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
