Understanding the free Command

Basic Usage of free

The free command is used to display information about system memory usage, including total, used, free, shared, buffer/cache, and available memory. This command helps in monitoring memory consumption on a Linux system.

free [OPTION]...

Options Available with free

-h (Human-readable)

Display memory sizes in a human-readable format (e.g., KB, MB, GB):

free -h

-b (Bytes)

Display memory sizes in bytes:

free -b

-k (Kilobytes)

Display memory sizes in kilobytes (default):

free -k

-m (Megabytes)

Display memory sizes in megabytes:

free -m

-g (Gigabytes)

Display memory sizes in gigabytes:

free -g

-s seconds (Continuous Mode)

Display memory usage at regular intervals in seconds:

free -s 5

-t (Total)

Display a line showing the total memory usage:

free -t

--help

Display help information for the command:

free --help

--version

Display the version information of the command:

free --version

Examples of free Command

Display Memory Usage Summary

free

This command displays the total, used, free, shared, buffer/cache, and available memory.

Display Human-readable Memory Usage

free -h

This command shows memory usage in a more readable format with units (KB, MB, GB).

Display Memory Usage Every 5 Seconds

free -s 5

This command updates the memory usage display every 5 seconds.

Understanding Memory Usage Information

The output of the free command typically includes the following columns:

Summary of Options

Option Description
-h Display memory sizes in human-readable format.
-b Display memory sizes in bytes.
-k Display memory sizes in kilobytes (default).
-m Display memory sizes in megabytes.
-g Display memory sizes in gigabytes.
-s seconds Display memory usage at regular intervals.
-t Display a line showing the total memory usage.
--help Display help information for the command.
--version Display the version information of the command.