Master Free Command in Linux with Examples
Everything You Need to Know About the Free Command in Linux
The "free" command in Linux is a helpful tool for monitoring system memory consumption. It can provide critical information about how much RAM is being used, how much is available, and what processes are consuming the most amount of RAM.
How Does the Free Command Work?
The free command summarizes information about the system's RAM and swap space usage. This information is usually presented in kilobytes. The output of the command shows the total amount of memory available in the system, the amount of memory being used, the amount of memory that is still free and available to be used as well as the percentage of memory being used.
Syntax of the Free Command
The syntax of the command is relatively simple and consists of just four main parameters. These parameters are: --total, -o, -m, and --human.
- --total: This will return the total amount of RAM and swap space on the system.
- -o: This will return the amount of memory being used.
- -m: This will return the amount of memory available.
- --human: This will return the amount of memory being used in a human-readable format.
Examples of the Free Command
Let's take a look at a few examples of the free command. The following command will return the total amount of system memory in kilobytes:
$ free --total
The following command will return the percentage of system memory being used:
$ free -m --total
Finally, the following command will return the amount of system memory being used in a human-readable format:
$ free --humann --total
Conclusion
The free command is a useful tool for monitoring your system memory usage. By using the free command, you can quickly get an overview of the amount of RAM being used, the amount of RAM that is still available, and the percentage of RAM being used. Hopefully this article has given you a better understanding of the free command and how it can be used in Linux.