Skip to main content

Cheatsheet & Examples: free

Published 2 min readMarkdown
Part of seriesCommon Tasks

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.

About the author

  • I work with Linux in the day, ballroom dancing at night. I use Arch, btw.

No comments yet. Be the first to comment.

More from this blog