On any Linux desktop someone has been created a widget/plug-in kind of application which will display in real time all the system resources, such as CPU, disk and free memory info (memory usage), etc. They are not only very useful but also good looking.
Well, they comes all the time with a price : they consume memory and CPU all of the time. And most of the time you don't really need them to run like every nanosecond, right?. So I have came up with a simple solution: a bash script that you can call it whenever you need to find that info by a keyboard shortcut (the Xfce desktop comes with a handy keyboard shortcut application that I am using for that, the other DM should also provide a such functionality).
Create a simple bash script (eg: showfreem) as the one bellow and then create a keyboard shortcut (eg: Ctrl+Alt+F) that will launch that script every time you need to find out that piece of information.
#!/bin/bash ICON_RES="scalable" ICON_EXT=".svg" notify-send -i /usr/share/icons/Tango/${ICON_RES}/devices/media-flash${ICON_EXT} "Free memory" "$(free -m | awk 'NR==2 {print "Total: "$2 " MB"; total=$2} NR==3 {print "Free : "$4 " MB"; free=$4} END {print "Used : " total-free " MB"}')"
Note: don't forget to make your bash script executable by chmod +x showfreem
As you can see this is just one line script code so it is really lightweight and also the consumed memory is released as soon the notification balloon is closed:
If you need/want you can embed much more information within this balloon, it is up to you to extend the above script. If you need help just let me know.
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.
Eugen Mihailescu
Latest posts by Eugen Mihailescu (see all)
- Dual monitor setup in Xfce - January 9, 2019
- Gentoo AMD Ryzen stabilizator - April 29, 2018
- Symfony Compile Error Failed opening required Proxies - January 22, 2018