Simple memory information widget for the Xfce panel (or anywhere else where you can run a shell command)

I was unsatisfied with the existing memory status applets for the Xfce panel, so I wrote a little shell script that shows me just the information I need. Now I use it via a "Generic Monitor" panel applet.

Put this at some place like ~/bin/memory-info and chmod +x it:

#!/bin/sh
meminfo=`free -m | grep 'Mem:'`

used=`echo $meminfo | cut -d" " -f3`
total=`echo $meminfo | cut -d" " -f2`
cached=`echo $meminfo | cut -d" " -f7`

really_used=`expr $used - $cached`

echo "Memory usage: $really_used / $total (Cached: $cached)"

Next, add a "Generic Monitor" applet to your Xfce panel, fill in the name of the file you just created and set a refresh time that suits you (like 3 seconds). Done.

Arne Hartherz Over 11 years ago