free command is used to display the amount of free and used memory in the system. It can also display the amount of swap space and its utilization. This command is useful in determining the memory usage of the system and can help in troubleshooting memory-related issues.
free command displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel.
To use the
free command, simply type
free in the terminal. The output will show the following columns:
total– the total amount of physical memory in the system
used– the amount of physical memory currently in use
free– the amount of physical memory currently available for use
shared– the amount of shared memory
buffers– the amount of memory used by buffers
cached– the amount of memory used by caches
The output also includes information on swap memory:
swap total– the total amount of swap space in the system
swap used– the amount of swap space currently in use
swap free– the amount of swap space currently available for use
free command can also be used with the
-h option to display the output in a more human-readable format:
$ free -h
- To check the memory usage of the system
- To troubleshoot memory-related issues
- To monitor memory usage over time
The following table lists the available options for the
||Display output in bytes|
||Display output in kilobytes (default)|
||Display output in megabytes|
||Display output in gigabytes|
||Display output in a human-readable format|
||Display memory usage N times with a delay of 1 second between each display|
- If the system is running low on memory, try closing unnecessary applications or services to free up memory.
- If the system is frequently running out of memory, consider upgrading the system’s RAM or adding more swap space.
freecommand is included in most Linux distributions and does not require any additional installation.
- The output of the
freecommand may vary depending on the version of the command and the Linux distribution being used.