Linux Commands

Understanding Free –m Output

Memory is among the system’s most important parts (RAM). Whenever server ram is used to its maximum capacity, the computer’s performance deteriorates. A tool in Ubuntu termed ‘free’ may be used to check memory use. The free instruction is a little but powerful Linux function that should be in every desktop machine’s toolbox. The storage details of the machine are handled by this instruction. Whenever we want to determine, if we could somehow run additional programs on our platform, we may use these metrics. It is also utilized to check the swap, buffer, and cache memory of our system.

Today, in this guide, we will discuss the use and working of the “free” command in the Ubuntu 20.04 shell along with the “-m” flag. Let’s begin with the implementation by the launch of the system’s “terminal” tool. You may use the “Ctrl+Alt+T” shortcut keystroke to open the shell while staying at the Ubuntu 20.04 desktop.

Update System

The very first thing after the system reboot is to make sure that it is up to date. This is because some of the updates may or may not be installed properly on our system. These updates are necessary to make our system work properly without any hesitation and halt. The “apt” package of our system is used for this particular purpose. So, we have been utilizing the apt package instruction in the shell to update and upgrade our Ubuntu system. The “sudo” keyword has been used to execute it with root privileges. After execution, it has asked for the root password for a root user of our system i.e., saeedraza. So, we have added our password and pressed the button “Enter” from the keypad of our system. The update has started downloading on our system manually.

Within the download of the update, the system has paused the process and asked to confirm this action of update. It shows the total space that will be used by this update process and if we want to continue it or not. So, we have tapped the key “y” to continue the system update on Ubuntu 20.04 system. The update process will be continued after that and concluded within a few seconds.

After the system update, we will have a look at the “man” instruction man page on our Ubuntu 20.04 terminal shell. The manpage will let us know about the “free” command description, its different options, their purposes, and usages in our system. To open the manpage of the “free” command, we have been using the keywords “man” and “free” in the query area of our shell.

After the execution of the man command with the keyword “free”, we have been encountered the below-shown manpage of the “free” command. The very first title id “Name” shows the description of “free” keyword usage in the shell i.e. show the total of free and castoff memory in our system. The synopsis shows the command syntax to be used in the shell. Here comes the description of free instruction on the shell. It shows the description of all the columns which will be generated upon this command usage. The first column is about the total memory our system has, the “used” column shows the amount of memory already utilized by our system, and the free column is all about the space left. There comes the columns of buffers, cache, and the shared memory of our system.

After the description of a free command, we have encountered the description of a free command “Options” which will be used as flags. Every option has its syntax and the description of what the particular option will do in the shell while used within the “free” command. We will take a look at all the options listed down in the image especially the “-m” option.

Let’s take a look at free command now. We will be using the command as a single keyword “free” in the shell and execute it by utilizing the “Enter” key. It is showing us the total memory we have, a memory we have already used, an unused memory as “free column”, the amount of memory shared between different processes of the system, the total amount of buffer or cache memory, and the amount of memory available now and can be utilized so far. The swap amount of storage is also shown. Whenever the actual Random-access memory is filled, swap is a capacity here on a disc that is utilized. Inert sites are shifted from memory to swap storage whenever an Ubuntu system operates out of memory. While running Ubuntu on a virtual environment, there is usually no swap disk. Therefore, the only choice is to build a swap document.

Here comes the “-m” option with the free command in the terminal of our system. So, we have tried it on our shell and got the resulted ram and swap memory in mebibytes. A mebibyte is a measurement unit that is a little greater than a megabyte unit.

Let’s have a look at the “mega” option of free command. It will show us the memory statistics in megabytes. The output shows all the information of memory in megabytes i.e., total, used, free, shared, buffer, cache, and available memory. You can see that megabyte is a little smaller than mebibytes as per the output.

Let’s show the memory statistics in gigabytes using the “Giga” option within the “free” query. The output shows that our system has a total of 4 Gigabyte memory. 2 gigabyte memory is free, 3 gigabytes is available and 1 gigabyte is utilized by the kernel via the buffer memory.

Conclusion

We have done with the explanation of a “free” query in Ubuntu 20.04 while using it with the “-m” flag in its terminal. We have covered the explanation of its options one by one within the “free” command in the Ubuntu shell. After that, we have taken a look at output columns while using the different options i.e. –m, mega, and gigabytes.

About the author

Saeed Raza

Hello geeks! I am here to guide you about your tech-related issues. My expertise revolves around Linux, Databases & Programming. Additionally, I am practicing law in Pakistan. Cheers to all of you.