Most Linux administrators run free within the first minute of logging in to a slow server because it provides a quick snapshot of memory usage.
The problem is that many older guides, describe an output format that modern systems no longer use. The familiar -/+ buffers/cache line is gone, and options such as -o may no longer be supported.
The free command is part of the procps-ng package and reads memory statistics from /proc/meminfo, a virtual file maintained by the Linux kernel. Its output has evolved over the years, most notably with the addition of the available column and changes to how used memory is calculated and this guide explains how to interpret modern free output and use its current options to monitor memory and swap.
The examples in this guide were tested on Ubuntu 26.04 LTS and Rocky Linux 10. Commands and output may vary slightly across distributions and procps-ng versions, so check free --help on your system when an option behaves differently.
How the free Command Reads Memory in Linux
Before running the examples, it helps to understand where the numbers come from. Once you know what each value represents, the output becomes much easier to interpret.
Linux uses otherwise-unused RAM for the page cache, which stores recently accessed file data in memory so subsequent reads can avoid slower disk access.
The kernel also uses memory for buffers and other caches. As a result, the free column on a busy server can be very small without indicating a memory problem.
Much of this cached memory can be reclaimed when applications need RAM, although reclaiming it depends on the type of memory and the current system workload.
That is why the available column is generally more useful than free when assessing memory pressure. It comes from the MemAvailable field in /proc/meminfo and estimates how much memory can be made available to new applications without swapping. The estimate accounts for reclaimable cache and other kernel memory considerations.
The free manual page (man 1 free) documents the output columns. Here is what each one means in plain language:
totalis the total usable RAM or swap available to the system, which may be less than the installed physical memory because of hardware reservations and other limitations.usedis the amount of memory reported as used. Inprocps-ng 4.0.1and later, it is calculated astotal - available. Older versions use a different calculation, so their output may not match newer versions or older monitoring scripts.freeis memory that is currently unused. It does not include memory occupied by applications, buffers, or caches.sharedis memory primarily used bytmpfsfilesystems, such as/dev/shm, although the value can include other shared-memory allocations.buff/cachecombines memory used for kernel buffers and caches, including the page cache. Much of this memory can be reclaimed when needed.availableestimates how much memory is available for new applications without having to swap. It is usually the most useful column for a quick assessment of RAM availability, although it does not guarantee that swapping will never occur.
What Changed Since Older free Versions
If you are following older guides or maintaining existing scripts, several changes in free are worth knowing because they can affect how you interpret memory usage and parse command output.
- The
-/+ buffers/cacheline: This line disappeared inprocps-ng 3.3.10, which introduced the available column in its place. Scripts that depend on fixed line numbers may accidentally read the swap line instead of the expected memory statistics. - The
-oand--oldoptions: Older versions supported-oto suppress the buffer-adjusted line. Modern versions no longer need this option because that line has been removed. Checkfree --helpon your system before using legacy commands. - Memory units: The
-k,-m, and-goptions display values in kibibytes, mebibytes, and gibibytes, respectively, using powers of 1024. For decimal units based on powers of 1000, use--kilo,--mega, or –-giga. - The used column: In
procps-ng 4.0.1and later, used is calculated astotal - available. Older versions use a different calculation, so the reported value can differ even on the same system. - Additional output options: Modern versions support useful options such as
-hfor human-readable units,-wfor separate buffer and cache columns,-cfor a specified number of repeated reports when used with-s,-Lfor single-line output, and-vfor committed-memory statistics. Check the installed manual page because supported options depend on the version.
Check That the free Command Is Installed
The free command is normally included in standard Linux installations, but some minimal container images omit it. If it is missing, you may see an error such as bash: free: command not found.
On Ubuntu and Debian, the package is named procps. Install it with:
sudo apt update sudo apt install -y procps
On Rocky Linux, AlmaLinux, RHEL, and Fedora, the package is generally named procps-ng. Install it with:
sudo dnf install -y procps-ng
Once installed, check the version:
free -V
Output:
free from procps-ng 4.0.4
Ubuntu 26.04 packages procps 4.0.4, while Rocky Linux 10 repositories provide procps-ng 4.0.4. The exact package release and version may vary with various Linux distribution updates and enabled repositories. Check your system’s output before relying on a particular option or calculation.
The examples in this guide target procps-ng 4.0.4. If your system uses an older release, consult free --help and man 1 free to confirm which options it supports.
1. Display System Memory with the free Command
With the version confirmed, start by running free without any options. It displays RAM and swap statistics in kibibytes by default.
free
Example output:
total used free shared buff/cache available Mem: 3990272 612480 2104316 18224 1273476 3377792 Swap: 2097148 0 2097148
This server has approximately 3.8 GiB of RAM. Although about 2.0 GiB is completely free, approximately 3.2 GiB is available for applications because much of the memory in buff/cache can be reclaimed.
The swap line shows approximately 2 GiB of configured swap, with none currently in use. That is useful information, but zero swap usage is not a requirement for a healthy system. Check memory pressure and swap activity alongside these figures when diagnosing performance problems.
2. Show Human-Readable Output with free -h
Raw kibibyte values are difficult to interpret at a glance. The -h option scales the values to readable units and adds the appropriate suffix.
free -h
Example output:
total used free shared buff/cache available Mem: 3.8Gi 598Mi 2.0Gi 17Mi 1.2Gi 3.2Gi Swap: 2.0Gi 0B 2.0Gi
The Gi and Mi suffixes stand for gibibytes and mebibytes, respectively, using powers of 1024. This is the same type of information shown by the default command, presented in a more readable format.
For quick checks during troubleshooting, free -h is often the most convenient choice.
3. Display Memory in Bytes, KiB, MiB, or GiB
Human-readable output is convenient for administrators, but fixed units are often more useful when comparing measurements or processing command output. The -b, -k, -m, and -g options select the unit, while --tebi and --pebi support larger units on systems with substantial memory.
-b,--bytesdisplays values in bytes.-k,--kibidisplays values in kibibytes. This is the default when no unit is specified.-m,--mebidisplays values in mebibytes.-g,--gibidisplays values in gibibytes. Because the output uses whole units, smaller amounts of memory can be hidden by rounding down.--tebiand--pebidisplay values in tebibytes and pebibytes, respectively, where supported by the installed version.
For example, to display memory in mebibytes, run:
free -m
Example output:
total used free shared buff/cache available Mem: 3896 598 2054 17 1243 3298 Swap: 2047 0 2047
The values are now easier to compare in a consistent unit. Keep in mind that displayed values may be rounded or truncated, depending on the selected unit and procps-ng version. If you are writing monitoring scripts, verify the output format and parsing assumptions against the version deployed on your systems.
4. Use Decimal Units with free –si and –mega
The unit options covered earlier use powers of 1024, but disk manufacturers, cloud providers, and some monitoring dashboards use powers of 1000. To display memory in decimal units, use --kilo, --mega, --giga, or --tera. You can also combine -h with --si for human-readable output using decimal units.
For example, to display memory in megabytes, run:
free --mega
Example output:
total used free shared buff/cache available Mem: 4086 627 2154 18 1304 3458 Swap: 2147 0 2147
The same system now reports approximately 4,086 MB of RAM instead of 3,896 MiB. These values describe the same amount of memory using different units: 1 MB equals 1,000,000 bytes, while 1 MiB equals 1,048,576 bytes.
This distinction explains why a cloud server advertised with 4 GB of RAM may show a different figure when you run free -h. The installed memory is not necessarily missing; the difference may simply come from how the units are measured.
If this cleared up why your memory figures never matched what your hosting provider advertised, share it with someone who is still trying to work out where their missing RAM went.
5. Split Buffers and Cache with free -w
So far, the buff/cache column has appeared as a single value, which is sufficient for a quick memory check. When investigating memory usage in more detail, it can help to see buffers and cache separately. The -w (wide) option does exactly that.
free -h -w
Example output:
total used free shared buffers cache available Mem: 3.8Gi 598Mi 2.0Gi 17Mi 96Mi 1.1Gi 3.2Gi Swap: 2.0Gi 0B 2.0Gi
The buffers column represents memory used for kernel buffers, corresponding to the Buffers field in /proc/meminfo. It is often relatively small.
The cache column includes the page cache and reclaimable kernel slab memory, corresponding to the Cached and SReclaimable fields in /proc/meminfo. This memory helps Linux avoid unnecessary disk access and can often be reclaimed when applications need more RAM.
A growing cache value is not automatically a problem. To determine whether memory is under pressure, also check available, swap activity, and other memory-pressure indicators.
6. Show Combined RAM and Swap Totals with free -t
Sometimes you need a quick view of the combined RAM and swap totals, such as when estimating the memory resources available to a workload. The -t option adds a Total line that combines the RAM and swap figures.
free -t
Example output:
total used free shared buff/cache available Mem: 3990272 612480 2104316 18224 1273476 3377792 Swap: 2097148 0 2097148 Total: 6087420 612480 4201464
In this example, the system has approximately 3.8 GiB of RAM and 2.0 GiB of swap, giving a combined total of about 5.8 GiB in the displayed accounting.
However, RAM and swap are not interchangeable. RAM provides much faster access, while swap uses disk-backed storage and can introduce substantial latency. The combined Total line is useful for understanding the overall memory accounting, but it does not tell you how much RAM is available without swapping or how much memory a workload can use before performance degrades.
For capacity planning, consider the available column alongside actual workload requirements, swap activity, and memory pressure rather than relying on the combined total alone.
7. Watch Memory at Regular Intervals with free -s and -c
A single snapshot shows only one moment, but memory problems often develop while a deployment, backup, or other workload is running. The -s option repeats the output at a specified interval, while -c limits the number of reports so the command exits automatically.
free -h -s 5 -c 3
Example output:
total used free shared buff/cache available
Mem: 31Gi 6.5Gi 22Gi 503Mi 3.1Gi 24Gi
Swap: 0B 0B 0B
total used free shared buff/cache available
Mem: 31Gi 6.5Gi 22Gi 533Mi 3.2Gi 24Gi
Swap: 0B 0B 0B
total used free shared buff/cache available
Mem: 31Gi 6.5Gi 22Gi 483Mi 3.1Gi 24Gi
Swap: 0B 0B 0B
The -s option accepts fractional intervals, such as 0.5, for half-second updates. If you omit -c, the command continues until you stop it with Ctrl+C.
Repeated snapshots help you spot changes in memory usage, but they do not reveal the entire picture. If available memory keeps falling or swap usage increases, investigate the workload and check memory pressure before deciding whether the server needs more RAM.
8. Print Memory Statistics on One Line with free -L
Repeated output can scroll quickly and be difficult to compare, especially when monitoring memory over time. The -L option, introduced in procps-ng 4.0.4, prints the statistics on a single line, making the output easier to scan or collect in a log.
free -h -L -s 5 -c 3
Example output:
SwapUse 0B CachUse 3.1Gi MemUse 6.4Gi MemFree 22Gi SwapUse 0B CachUse 3.1Gi MemUse 6.3Gi MemFree 22Gi SwapUse 0B CachUse 3.1Gi MemUse 6.3Gi MemFree 22Gi
The labels represent selected memory statistics:
SwapUseis the amount of swap currently used.CachUseis the combined buffers-and-cache figure.MemUseis the reported memory usage.MemFreeis the amount of completely unused RAM.
The exact formatting and spacing can vary with the installed version and output units. This format does not include available, so use the standard output when you need to assess how much memory can be made available to applications.
9. Show Committed Memory with free -v
The previous examples show current memory statistics, but Linux also tracks memory commitments: the amount of memory the kernel has promised to applications. This is not necessarily the same as the physical RAM they have actually touched or are currently using.
The -v option adds a Comm row showing the commit limit, committed memory, and the difference between them.
free -h -v
Example output:
total used free shared buff/cache available Mem: 31Gi 6.5Gi 22Gi 500Mi 3.1Gi 24Gi Swap: 0B 0B 0B Comm: 15Gi 51Gi -35Gi
In the Comm row, total represents the commit limit, used represents committed memory, and free represents the difference between the two. The `free` value can be negative when committed memory exceeds the limit.
This information is particularly useful when Linux memory overcommit is disabled by setting vm.overcommit_memory = 2. Under this policy, the kernel restricts commitments that would exceed the applicable commit limit, and some memory-allocation requests can fail even when free -h reports available RAM.
However, allocation failures depend on the allocation type and system policy. A negative committed-memory balance is not, by itself, proof that every new allocation will fail. Consult the kernel’s overcommit settings and /proc/meminfo when diagnosing such problems.
10. Show Low and High Memory with free -l
The -l option displays detailed low- and high-memory statistics. This distinction is most relevant to older 32-bit Linux systems, where the kernel historically divided physical memory into regions it could address directly and regions requiring additional mapping.
free -l
Example output on a system where the low/high distinction is applicable:
total used free shared buff/cache available Mem: 32588184 7070268 23178584 462872 3239432 25517916 Low: 32588184 9409600 23178584 High: 0 0 0 Swap: 0 0 0
The exact values depend on the kernel architecture and the memory zones it reports. On many modern 64-bit systems, the high-memory row is zero or the distinction is not useful for routine troubleshooting.
For most contemporary servers, free -h is sufficient for everyday memory checks. Use free -l when investigating low/high memory behavior on a system where that distinction matters.
11. See How the Page Cache Changes free Output
Now let’s put the theory from the start of this guide to the test. Watching the page cache grow helps explain why a low free value does not necessarily indicate a memory problem. We’ll write a 1 GiB file and compare memory statistics before and after.
First, take a baseline reading:
free -h
Example output:
total used free shared buff/cache available Mem: 31Gi 6.6Gi 22Gi 516Mi 3.2Gi 24Gi Swap: 0B 0B 0B
Next, write a 1 GiB file of random data into your home directory:
dd if=/dev/urandom of=~/cache-test.img bs=1M count=1024 status=progress
This writes data through the filesystem, where it can occupy page-cache memory. The actual memory changes depend on the filesystem, kernel, and current memory pressure.
Run free -h again:
free -h
Example output:
total used free shared buff/cache available Mem: 31Gi 6.7Gi 21Gi 516Mi 4.2Gi 24Gi Swap: 0B 0B 0B
In this example, free has dropped by about 1 GiB and buff/cache has increased by a similar amount, while available has barely changed.
This illustrates how Linux can use otherwise-unused RAM for cached file data without significantly reducing the memory available to applications.
Your results may differ because Linux can reclaim cache under memory pressure, and writing a file does not guarantee a specific change in the reported values.
Finally, remove the test file:
rm ~/cache-test.img free -h
Removing the file makes its storage available for reuse, but the kernel may retain cached pages temporarily. Do not expect buff/cache to return immediately to its original value.
buff/cache column easier to understand, share it with a teammate who keeps getting paged about low-free-memory alerts.12. Check Available Memory in a Script with free -b
The previous example demonstrated why available is generally more useful than `free` when assessing memory pressure. You can use it in a monitoring script that warns when available memory drops below 10% of total RAM.
Create the script:
sudo nano /usr/local/bin/memcheck.sh
If nano is not installed, use another editor, such as vi:
sudo vi /usr/local/bin/memcheck.sh
Add the following content:
#!/usr/bin/env bash
# /usr/local/bin/memcheck.sh
set -euo pipefail
THRESHOLD=10
read -r total available < <(free -b | awk '/^Mem:/ {print $2, $7}')
percent=$(( available * 100 / total ))
if (( percent < THRESHOLD )); then
logger -t memcheck "only ${percent}% memory available on $(hostname)"
echo "WARNING: only ${percent}% memory available"
exit 1
fi
echo "OK: ${percent}% memory available"
Save the file and exit the editor. Here is what the important lines do:
THRESHOLD=10sets the warning threshold to 10% of total RAM. Adjust it to suit your workload and monitoring requirements.free -bdisplays memory values in bytes, avoiding the unit scaling used by human-readable output.awk '/^Mem:/ {print $2, $7}'extracts total and available memory from the standard `free` output. These field positions assume the normal output format, without-w.logger -t memchecksends the warning to the system logging facility. On systems using the systemd journal, you can usually retrieve it withjournalctl -t memcheck.exit 1returns a non-zero status when the threshold is breached, allowing cron wrappers, systemd units, or monitoring agents to detect the warning.
Make the script executable and run it using its full path:
sudo chmod +x /usr/local/bin/memcheck.sh /usr/local/bin/memcheck.sh
Example output:
OK: 84% memory available
The percentage shown will depend on the system’s current memory state.
To run the check every five minutes, open root’s crontab:
sudo crontab -e
Add this line:
*/5 * * * * /usr/local/bin/memcheck.sh >/dev/null
The >/dev/null redirect suppresses standard output, including the normal OK message. Warnings are still sent to the system logger, and the script returns a non-zero exit status when the threshold is breached.
However, cron does not automatically alert you just because a command returns a non-zero status; configure a separate monitoring or alerting mechanism if you need to be notified.
Tips for Reading free Output on Production Servers
With the script in place, you can catch real memory pressure automatically, and a few habits will help you read free correctly when you’re checking a server by hand.
Judge memory pressure by the available column and by swap activity, not by free. A small amount of swap in use is normal, because the kernel moves pages that haven’t been touched for a long time out of RAM.
Swap becomes a problem when it keeps growing while available keeps shrinking, which you can confirm by watching the si and so columns in vmstat 5, since those show pages moving in and out of swap right now.
Avoid running echo 3 > /proc/sys/vm/drop_caches to “free up memory”. It makes the free column look better for a few minutes, but the kernel then has to read everything back from disk, so applications slow down while the cache refills. The kernel already releases cache automatically when applications need memory, as the page cache example showed.
When available really is low, free tells you that there is a problem but not which process is causing it. The next step is ps -eo pid,comm,rss --sort=-rss | head to list the processes using the most resident memory, followed by journalctl -k | grep -i 'out of memory' to check whether the kernel’s OOM killer, which is the kernel feature that stops a process when memory runs out, has already ended something.
Finally, remember that inside a container free reads the host’s /proc/meminfo, so it shows the host’s memory rather than the container’s limit, unless the runtime uses a tool such as LXCFS to provide a container-specific view. To see a container’s real limit, check its cgroup files, such as /sys/fs/cgroup/memory.max on cgroup v2 systems.
Conclusion
You now know how to read the current free output, why the available column matters more than free, and which options replace the ones that older guides still mention. You also have a small script that checks available memory automatically and logs a warning when a server starts running short.
If you’d like to go beyond free and learn the tools that show which processes are using memory, CPU, and disk, our Linux Performance Monitoring Tools course walks through top, htop, vmstat, iostat, and sar with real troubleshooting examples. For a wider set of everyday commands like this one, the 100+ Essential Linux Commands course is a good next step.
We’d love to hear how you check memory on your own servers. Do you rely on free -h, a monitoring agent, or something like htop?
Have you ever had a script break because of the old -/+ buffers/cache line? Feel free to share your memory check one-liners or paste a confusing free output in the comments, and we’ll help you read it.
How to find out RAM Memory details on an embedded system?
I know from /proc/meminfo vstat, free etc, but none of the commands give you exact RAM i have.
Example, I have checked on a system where i know the RAM size of 256 Mb, but none of the above command displays 256Mb.
is that correct or am i missing something?
Good beginner info on how to read the memory usage in Linux.
#8 says “Dispaly.” It should say “Display.”
Nice and neat info. I believe you meant all the mentioned kb, mb, gb are actually kibi, mebi and gibi rather than kilo, mega and giga.
Hi,
I would request you, please let us know each fields explanation of free -m output. ( Buffer/cache/shared)
Regards,
Sathish
@Sathish,
We already explained each switch used with free command in this article, I hope you gone through it each point, still I will update you that free -m is used to show the amount of memory in megabytes.
Thanks for sharing the commands, your site is good source of information for me…
Hi,
I am newbie to linux. I am practising ubuntu in vmware workstation installed in PC. How do i surf internet using ubuntu while i am in vmware workstation ? Please assist.
@Sam,
Under Vmware there is a Network Settings tab, adjust values there to enable internet in VMware guest OS..
Excellent!
Thank you for the share, great read. How can I reduce the memory consumption used? I am using a virtual box with ubuntu 14.04 LTS. I have only 82M of 500M free memory left?
I might guess it is because the low memory I have assigned to Virtual machine 512M upon initialising it.
@Sinan,
500MB is not enough to run Ubuntu 14.04, you need at least 1G or 2G of ram to run Ubuntu properly..or else you can stop some unwanted applications to reduce memory consumption, you need to use top command to trace the applications which are utilizing high ram usage..
@Sara
That’s not related to memory as df is used to report file system disk space usage, free is the memory (RAM) and swap usage.
I prefer the more tidy look of ‘df -hT’, added plus percentage of the used space. Btw. i enjoy your posts :-)
TQ & 5* i give to you … im newbie in linux … this is my 2nd linux (ubuntu 14.04) 1st i use (fedora19) sory my english .. i read your all your post (tecmint).. & TQ again for good post.. (y)
@Ali,
Thanks for such kind words, we continue to provide such usefull artilces to our newbies like you…:)
Happy New Year Mr.Ravi,
Articles which is published in this website is very useful to beginners like me hats off .God Bless you
@Gautham,
Wishing same to you.. a Very Happy New Year ahead…….and thanks for appreciating our articles..
Thanks for sharing.
Also in Debian, “h” parameter to human readable format (free -h).
@Ramazan,
Thanks for about that ‘-h’ parameter in Debian..