Skip to main content

Command Palette

Search for a command to run...

Cheatsheet & Examples: free

Updated
2 min read

The free command displays the amount of free and used memory in the system. It can show information about physical RAM and swap space.

Displaying Basic Memory Statistics

Example Usage: free

What it does: Displays a summary of the system's memory usage, including total, used, free, shared, buffer/cache, and available memory, in kilobytes.

Command-line Arguments Explained:

  • (No arguments are used in this basic usage.)

Displaying Memory in Human-Readable Format

Example Usage: free -h

What it does: Displays memory usage in a human-readable format (e.g., KB, MB, GB), making it easier to understand the numbers.

Command-line Arguments Explained:

  • -h: Prints the output in human-readable format.

Displaying Memory Continuously

Example Usage: free -s 5

What it does: Continuously displays memory usage, updating every 5 seconds.

Command-line Arguments Explained:

  • -s: Enables continuous monitoring.
  • 5: Specifies the interval in seconds between updates.

Displaying Only Specific Columns

Example Usage: free -k -w

What it does: Displays memory usage in kilobytes, and includes the "shared" column.

Command-line Arguments Explained:

  • -k: Prints output in kilobytes.
  • -w: Display the "shared" column

Displaying Memory in a Specific Unit

Example Usage: free -m

What it does: Displays memory usage in megabytes.

Command-line Arguments Explained:

  • -m: Prints the output in megabytes.

Displaying Memory Without Buffers/Cache

Example Usage: free -k --no-buffer

What it does: Displays memory usage in kilobytes, omitting the buffer/cache information.

Command-line Arguments Explained:

  • -k: Prints the output in kilobytes.
  • --no-buffer: Excludes the buffer and cache columns from the output, providing a more direct view of used and free memory.

More from this blog

Hong's Tech Blog

110 posts

The blog is older than you know. I prefer counting from the emergence of one integral anomaly to the emergence of the next, in which case this is the forth version.