How To

free Command in Linux: Check Memory Usage and Interpret Output

The free command in Linux gives you a quick summary of RAM and swap usage. It reads from /proc/meminfo and displays the data in a single table with one command.

This guide covers how to use the free command in Linux and what each column in its output means.

How to Use the free Command in Linux

The basic syntax is:

bashfree [OPTIONS]

Run free without options to see memory and swap in kibibytes (KiB). One kibibyte equals 1024 bytes — not the same as a kilobyte (KB), which is 1000 bytes. The distinction matters when reading output or comparing values from different tools.

bashfree
              total        used        free      shared  buff/cache   availableMem:        8075208     3204964     1310540      551232     3559704     4198340Swap:       2097148           0     2097148

The output has two data rows: one for physical RAM and one for swap.

Understanding free Command Output: Columns Explained

Each column reports a specific memory measurement:

  • total — total RAM available to the system
  • used — memory currently in use. Calculated as used = total - free - buffers - cache. This is why used looks high even on a lightly loaded system: buffered and cached memory counts toward the total, not just application memory
  • free — memory not used for anything at all
  • shared — memory used by tmpfs and shared memory segments between processes
  • buff/cache — the combined total of kernel buffers (metadata for filesystem operations such as inode and directory data) and page cache (file content kept in RAM to avoid repeated disk reads). Linux fills free RAM with this cache because idle RAM is wasted RAM. The kernel reclaims this memory immediately when applications need it
  • available — the most useful column for capacity planning. It estimates how much memory you can give to a new application without triggering swap, adding reclaimable buff/cache to the free total

The practical difference: a system showing 50 MB free but 3 GB available has plenty of RAM. Reacting to the free column alone leads to false alarms.

Swap row: zero in the used swap column is the normal and healthy state. When swap usage climbs, the system is moving RAM pages to disk, which degrades performance.

Display Options: Human-Readable, Units, Totals, and Live Updates

Human-readable format — the most practical option for daily use:

bashfree -h

This auto-selects MB or GB based on the values.

Specific units. --mega uses SI megabytes (powers of 1000); -m uses mebibytes (powers of 1024):

bashfree --mega    # megabytes: 1 MB = 1000 KBfree -m        # mebibytes: 1 MiB = 1024 KiB

Wide mode splits buff/cache into two separate columns for buffers and cache:

bashfree -h -w

Show column totals — adds a line combining RAM and swap:

bashfree -h -t

Live updates — refresh every N seconds until CTRL+C:

bashfree -h -s 5

Stop after a fixed number of updates with -c:

bashfree -h -s 5 -c 10

For a quick check, free -h is all you need. If available is consistently low relative to total, the system is under memory pressure and may start swapping. Use top or htop when you need per-process memory detail. Leave a comment below if you run into any issues.

Cyber Defence

Recent Posts

rmmod Command in Linux: Remove Kernel Modules and Blacklisting

The rmmod command in Linux removes a loaded module from the running kernel. Because the kernel has…

25 seconds ago

diff Command in Linux: Compare Files and Create Patches

The diff command in Linux compares two text files line by line and shows the lines that…

10 minutes ago

Flush DNS Cache on Windows, Linux, and macOS: Quick Commands

DNS cache is a temporary database your OS and browser build as you browse. Each time you visit a website, the domain-to-IP mapping is saved locally, cutting out the round trip to a remote DNS server on repeat visits. Stale entries are the most common reason to flush the DNS cache: a server moves to a new IP, but your OS or browser still routes to the old address. This guide covers how to clear the DNS cache on Windows, Linux, and macOS, and how to flush the separate cache stored inside Chrome and Firefox. Flush DNS Cache on Windows The command is the same on Windows 10, Windows 11, and earlier supported releases. Open Command Prompt with administrator privileges. Type cmd in the Windows search bar, right-click Command Prompt, and select Run as…

15 minutes ago

Change User Password in Ubuntu: Command Line and GNOME GUI

Using a strong, unique password for every account is one of the most effective security…

1 day ago

Enable and Disable the Root Account in Ubuntu: Full Guide

Ubuntu locks the root account by default. New users often wonder what the root password…

1 day ago

Configure Netplan on Ubuntu: DHCP, Static IP, Wi-Fi, and Bridges

Since Ubuntu 17.10, networking is configured with Netplan rather than the older /etc/network/interfaces file. You write a…

1 day ago