Smem Tool To Display Memory Usage More Accurate in Linux
Last Updated :
14 Feb, 2022
Multiple tools are available to monitor the memory usage on a Linux system. Memory management by monitoring memory usage is one of the important things to do on our Linux system, Smem is one of the memory usage monitoring tools available in Linux. Smem displays the memory usage of the processes on the command line, smem also displays a Graphical Output using color-coded pie and/or bar chart. With smem, we can easily visualize memory use on our system.
Installing Smem:
On Debian/Ubuntu smem can be installed from the repositories by using the following command:
sudo apt-get install smem
sudo apt-get install smemCommand-Line Options:
After we are done with the installation, we can run smem as a normal user, it displays memory usage by a process that the particular user has started, the processes are arranged in order of increasing PSS. Now we can get a report of the memory consumed by all processes launched with the current user ID, Swap, USS (Unique Set Size--this portion is occupied by a process which is a part of the main memory and that is private), PSS (Proportional Set Size---this portion is occupied by a process which is a part of the main memory and composed by private memory), and RSS (Resident Set Size--the portion of memory that is occupied by a process in main memory) in increasing order. This command gives a report on all running PIDs just by typing the following command in the terminal:
smem
unprivileged user report
You can also run smen as a superuser to view the report of memory usage by all the system users, across the whole system by using the following command:
sudo smem
privileged user report
There are many more options that can be invoked while using smem, you can check that out in smen manual by using the following command :
man smen
smen manualGenerating Graphical Output:
We can generate graphical output by generating a graphical chart to show memory usage. But we need the following to be installed beforehand:
- Python (2.4 or above)
- matplotlib library: It is used to generate the charts.
Ubuntu/Debian users can get matplotlib by running the following command :
sudo apt-get install python-matplotlib
Installing python-matplotlib
Once you have installed them, you can now get a visual representation of memory usage in the following form:
- pie chart
- bar graph.
Using pie chart:
With a pie chart you are able to view the memory usage(USS, PSS, and RSS) in form of a pie chart by using the following command:
smem --pie name -s uss
pie chart
The above screenshot generated a pie chart showing memory usage by USS. To get the PSS and RSS, simply we can replace USS with PSS or RSS in the above command.
And also you can generate a bar graph using the --bar command to get a bar graph.
smem --bar name -s uss
Similar Reads
How to Use Glances to Monitor Remote Linux in Web Server Mode? Glances is a system monitoring tool for Linux machines, it is used to monitor system resources in web server mode or through the web browser. It is an alternative to top and htop monitoring tools. This tool has various features and also provides bits of information on a single screen. Glances is a c
3 min read
Determine Memory Usage of Data Objects in R In this article, we are going to discuss how to find the memory used by the Data Objects in R Language. In R, after the creation of the object, It will allocate some space to the particular object. The object in memory is stored in bytes. Numeric type can allocate 56 bytes and character type can all
2 min read
How to Install and Use BpyTop Resource Monitoring Tool in Linux? It's just as critical for terminal users to be able to keep track of their system's resource use. Knowing how much of your system's resources are being used allows you to make more educated decisions about general system maintenance. Top and htop are two choices, but they only show a few device metr
2 min read
Installing atop Tool To Monitor the System Process in Linux atop is an ASCII full-screen interactive performance monitor which is kind of similar to the top command to view the load over a Linux system. The job of the most critical hardware resources (from a performance point of view) at the system level, i.e. CPU, memory, disk, and network can be seen. atop
7 min read
How to use Linux Cockpit to manage system performance Cockpit is a web-based graphical management tool for Linux machines on your computer. Having Cockpit on your server allows you to manage events on the user interface of a browser. Our typical admin tasks include setting up your firewall, changing your network settings, managing storage, creating acc
5 min read
Menu Driven Shell Script to Check Memory and Disk Usages In Linux most of the time, we automate things using the bash scripts. Some script has only one functionality, but some script can do more than one functions. For that, we have to provide the menu to select the option which function should be performed now. This script is called as Menu-Driven Progra
4 min read