Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a n00b when it comes to bash scripting, so I was hoping someone could help me out.

I have a server running 11.04, and my message of the day includes how much memory is currently used:

System information as of Tue Sep 24 10:58:28 MDT 2013

  System load:  0.0                Processes:           90
  Usage of /:   16.6% of 19.68GB   Users logged in:     0
  Memory usage: 49%                IP address for eth0: XX.XX.XX.XX
  Swap usage:   12%                IP address for eth1: XX.XX.XX.XX

I spun up another server running 13.04, and that message isn't there. So it looked into how to add it, and found on my 11.04 server under /etc/update-motd.d there is a link to a script at /usr/share/landscape/landscape-sysinfo.wrapper:

cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
[ "$cores" -eq "0" ] && cores=1
if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then
    echo -n "  System information as of "
    echo " System information disabled due to load higher than $threshold"

I added this script to my 13.04 server, but the script must be running into an error somewhere because it shows the "else" message, "System information disabled due to load higher than 1.0". Both servers have the same specs, other than the version of Ubuntu they're running. How can I edit this script on my 13.04 system to get it to show current memory usage?


It looks like 13.04 doesn't have landscape. I ran dpkg -l | grep landscape and no results. 11.04 has it running. So I guess the question is, how can I show memory usage without landscape?

share|improve this question

I have no idea why your dpkg command didn't return the landscape-common package because it does exist in Raring and owns the /usr/bin/landscape-sysinfo file.

Install it with this command:

sudo apt-get install landscape-common
share|improve this answer

If you want to display your memory usage in a landscape like way:

free -k | {
    read ; read TITLE TOTAL USED REST
    echo "Memory usage: $(( 100 * $USED / $TOTAL ))%"

    #you also want swap displayed ?  No problem

    read ; read TITLE TOTAL USED REST
    echo "Swap usage:   $(( 100 * $USED / $TOTAL ))%"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.