Thursday, July 26, 2012

Use "free" to monitor memory usage continuously



The "free" command is used to display the memory usage info of your computer. But with the normal "free" command, you get the info only once. To use "free" to display the memory usage of your computer continuously, you can use the "-s" option with the "free" command. For example, to display the info every 2 seconds, you can use the following command:

free -s 2

With this command, the memory usage will be printed continuously in the terminal after every 2 seconds.


Another way you can try is to combine the "watch" command with "free". For example, to get the memory usage info every 2 seconds using "watch" and "free", the command you can use is:
watch -n 2 free

And you will have an output like this:


No comments:

Post a Comment