When your computer is slowing down, the first thing you can check to inspect the problem is the memory usage. In Linux, there are a bunch of tools you can use to check the memory usage, with free being the most common one.
Memory usage checker tools like free will only show the overall use of the memory on your computer without showing the detailed memory consumption of each app. To check the memory consumption of each app you can use task managers like Gnome System Monitor and LXTask.
Following are the best tools you can use to check memory usage on Linux.
free is the default tool you can use to check the memory usage in Linux. You can use this tool by simply typing
freeon the terminal. However, the output will be less readable if you use free without options. free comes with a row of options to get customized output. One of which is “-h” which will tell free to display the memory usage in a more human-readable output. If you type
free -hon the terminal, you will get the following output.
Much more readable than
nmon is an additional administration tool on Linux. It is not installed by default in most Linux distros. However, the vast majority of Linux distros have added this tool to their software repositories so you can effortlessly install it using the package manager of the distro you use. Or, you can also download the package here if your distro haven’t added nmon. We have covered how to use nmon in this article. To check the memory usage with nmon, you can type
nmonon the terminal and then use the “m” button. nmon will display the memory usage stats in a real-time, refreshed every 2 seconds.
htop is basically a CLI-based task manager, but you can also use it to check the memory consumption in Linux. htop will also display the memory consumption in a real-time. The memory consumption will be displayed in a colorful bar. Simply type
htopon the terminal to use this tool. However, chances are you will install it first since htop is not the default tool in Linux.
Same as htop, the native function of top is task manager, but since the tool also displays the memory consumption on your Linux system, there is no bad to use it every time you need to check the memory usage in your Linux system. top itself is a default task manager in Linux so you don’t need to install it anymore. Simply type
topon the terminal and you will see the following ouput.
I know, the output (on the memory usage section) is not too human-readable.
glances is another CLI-based task manager for Linux. You can also use this tool to check the memory consumption in your Linux system. The tool also displays the memory usage stats in a real-time. Compared to top, the information displayed by glances is more readable. glances is not a default tool in Linux so you will need to install it yourself. If your distro hasn’t added glances on its software repository, you can get the package of glances from its official GitHub page.
Another tool you can use to check the memory usage in Linux is vmstat. However, you will probably won’t too impressed with the output generated by this tool. It’s not readable enough, much like free without option. vmstat doesn’t have an option to turn the output into a more readable stats. To use this tool, simple type
vmstaton the terminal. You can use the option of “-s” to display the output vertically.
So, which one is your favorite tool?