free -m Command in Linux
Monitoring memory is an important part of Linux server administration. When a server becomes slow or an application consumes excessive resources, checking RAM usage is often a useful first step.
The free command provides information about memory and swap usage. With the -m option, the values are displayed in megabytes.
What Is free -m?
Run:
free -m
A typical output looks like:
total used free shared buff/cache available
Mem: 7844 2140 1180 180 4524 5160
Swap: 2047 0 2047
The exact values depend on the system.
Understanding the Output
Total shows the total memory available.
Used shows memory currently in use.
Free shows memory that is currently unused.
Shared represents shared memory usage.
Buff/cache shows memory used for buffers and filesystem caching.
Available estimates memory that can be used by applications.
The Swap row shows total, used, and available swap space.
Why Use free -m?
The command is useful for:
- Checking server RAM usage.
- Troubleshooting memory problems.
- Monitoring swap usage.
- Reviewing resource usage quickly.
- Using memory values in simple scripts.
Using megabytes can also make numerical values easier to compare in certain monitoring or scripting tasks.
free -m vs free -h
The main difference is how values are displayed.
free -m
shows values in megabytes.
free -h
shows values in human-readable units such as MB, GB, or TB.
For quick manual checks, free -h is often easier to read. For consistent numeric output, free -m can be useful.
Conclusion
The Linux free -m command is a simple way to check RAM and swap usage in megabytes. It is useful for server monitoring, troubleshooting, and basic resource analysis.
Understanding values such as used, free, available, and swap can help developers and system administrators identify potential memory-related issues.