How to Use free Command on Linux

How to Use free Command on Linux

Knowing how to use free command on Linux is crucial to know the processing power of your computer system. Here’s a quick guide on how you can do it right now. 

Random access memory (RAM) is one of the vital components for running software on the computer system. Running a system with less RAM will make the system lag. More RAM means more software program space and faster load and execution time. 

In this article, we will talk about one of the utilities for checking the amount of memory used by the system and the memory current available using the free command.

How to Use free Command on Linux

Often, when installing new software on your computer, such as a Linux system, you will want to see the available RAM or system memory. By using the free command, you can not only check free and used memory, but you can also guess if your system needs a RAM upgrade. 

This depends on the software choices and the processes loaded on system startup.

The free tool

The free tool is, by default, available in Linux operating system. This command can be used to check the available and used memory on the system. It displays total, free, shared, available, and swap memory. The command can also be used to monitor system usage and enable the system administrator. This is to check if the system can cope with the requirements of the user and can run the requested software and services.

Using the free tool

We will now discuss the free tool in detail. In order to run the subsequent few commands, you should have a Linux-based system and access to the Terminal. The general usage of the command is as follows:

free [options]

Now, to run the free command most simply, go to the menu and open a terminal. Then, you can check the available memory by using the following command:


You will see the following information:

  • Total – It is the amount of total memory installed on your system
  • Used – It is the memory your system is currently using
  • Free – The free memory which is not allocated to any other software
  • Shared – The amount of memory shared between the processes
  • Buffers – The memory used by the kernel
  • Available – The available memory is not occupied by the operations and can be allocated to any other process

Displaying the memory in various units for the free tool

There are a number of options for the free tool. For instance, you can get the memory status in different units such as KB, MB, GP, and TB. For this purpose, you can use the following command:

$free -m

Here, m stands for megabyte, which is generally used. You can specify the following units:

  • -b for bytes
  • -k for kilobytes
  • -g for gigabytes
  • -t for terabytes
  • -h for human readable form

Monitoring the system continuously

You can monitor the system memory continuously until the terminal is closed. For this purpose, the following command can be used:

$free -s 3

Here, the value of the s option specifies the delay between successive outputs. You can also set the specific number of cycles with the following command:

free -s 3 -c 4

Here, the c option is used for specifying the cycles.

Displaying the sum of all memory

In addition, you can also display the sum of all the memory (the sum of memory and swap) by using the following command:

$free -t

Separate buffer and cache columns

By default, the buffer and cache information are combined in the output. You can see the information with the –w option. The following command illustrates it:

free -w

Summary of available options

We now summarize the various options available with the free tool. The table below shows the following options. As you can see, there are options for displaying help, version information, and showing memory in different units. And other options for monitoring the system every few seconds and counting the number of times.

  • -b or –bytes: Displays the information in bytes
  • -k or –kibi: Displays the information in kilobytes
  • -m or –mebi: Displays the information in megabytes
  • -k or –gibi: Displays the information in gigabytes
  • --tebi: Displays the information in tebi bytes
  • --pebi: Displays the information in pebi bytes
  • -h or –human: The best possible representation for humans to the shortest three-digit unit
  • -c or –count: Refreshes and show the output count times
  • -l or –lohi: Show details of low and high memory statistics
  • -s or –seconds: Updates the output every s seconds
  • --si: Use the power of 1000
  • -t or –total: Display a line showing the total column
  • --help: Displays the help
  • -V or –version: Displays the version information

And that’s it, we have discussed the free tool. It is a promising tool that can be used to display the free memory and the occupied memory by the system. We discussed the various options used with this tool. The tool is convenient when installing or updating the system via new software, as you must know the currently available memory. 

Having low memory may slow down the system installation, or you may not be able to install the software.

If this guide helped you, please share it.

Leave a Reply
Related Posts