Top 7 uses of The “free” command for monitoring Linux Memory Usage

Swastik Mukherjee
3 min readJan 21, 2022

Hey there! Welcome to the world of Linux freaks and best use of “free” Linux command. Imagine you are almost done with your job and suddenly an incident is logged for abrupt process termination due to lack of memory in production! It’s a nightmare.

But let’s see how we can gauge the memory usage in Linux. Please note that,I am not going with “how to Troubleshoot the Above Problem” . Rather I intent to show you demonstration of free command. As usual, lets see what the usual man page has to say about the “free” command.

The excerpt of man free command

So, we can clearly understand from the above output that the free command tells the used and the free primary memory (Basically RAM) of your system. Also, It parses ‘/proc/meminfo’ for the same. So, let’s see what other things this files care for?

/proc/meminfo details

But, imagine you are stuck in prod issue and you want to quickly find out th memory usage. so how do you get the “only necessary information” or parameter for the same ? Here comes the ‘free’ for you. Let’s see the output.

  1. Show Memory Usage

2. Show me more human

human readable format

3. Lets -m for Megabyte, -g for Gigabyte and -b for byte and You can guess more

play more, know more

4. Let’s total the Swap space and Memory space in Gigabyte

-t for total, -g for gigabyte

5. Let’s monitor for particular interval

Memory usage under 2 second interval

6. show detailed low and high memory statistics

club the parameters my friend

7. Help yourself for free

Always explore by yourself to learn more

There are many use cases, but we as a Server guy try to play and move around with this commands. Feel free to use The free command freely (Not in prod chap! :wink: )

--

--