Cybersecurity Updates & Tools

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.