X11 free memory info

Please note that this blog has been moved.

Now it has its own domain: mynixworld.info 🙂

If you want to read the latest version of this article (recommended) please click here and I open the page for you.

On any Linux desktop someone has been created a widget/plugin kind of application which will display in real time all the system resources, such as CPU, disk and 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. So I 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.

notify-send -i /usr/share/icons/Tango/48x48/devices/media-flash.png "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.

About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in linux, X11 and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s