while [ true ]; do cat /proc/loadavg | perl -ne 'm/(^[^ ]+)/; $L = $1; print "*" x $L; print " $L\n";' ; sleep 6; done

Visual system load display

It takes the first value of /prov/loadavg to print that many stars followed by the value.
Sample Output
******************** 20.98
********************* 21.30
******************* 19.92
**************** 16.85
*************** 15.50
************** 14.90

0
By: t3o
2017-10-13 06:47:06

These Might Interest You

  • I run this via crontab every one minute on my machine occasionally to see if a process is eating up my system's resources.


    0
    load=`uptime|awk -F',' '{print $3}'|awk '{print $3}'`; if [[ $(echo "if ($load > 1.0) 1 else 0" | bc) -eq 1 ]]; then notify-send "Load $load";fi
    adimania · 2013-02-06 08:30:24 1
  • While `echo rm * | batch` might seem to work, it might still raise the load of the system since `rm` will be _started_ when the load is low, but run for a long time. My proposed command executes a new `rm` execution once every minute when the load is small. Obviously, load could also be lower using `ionice`, but I still think this is a useful example for sequential batch jobs. Show Sample Output


    0
    find . -type f -exec echo echo rm {} '|' batch ';'|bash
    Ztyx · 2013-03-01 15:14:08 0
  • GoAccess is an open source real-time Apache web log analyzer and interactive viewer that runs in a terminal in *nix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly. http://goaccess.prosoftcorp.com/ Show Sample Output


    1
    goaccess -f /var/log/apache2/access.log -s -b
    allinurl · 2010-10-25 20:03:18 1
  • Show the current load of the CPU as a percentage. Read the load from /proc/loadavg and convert it using sed: Strip everything after the first whitespace: sed -e 's/ .*//' Delete the decimal point: sed -e 's/\.//' Remove leading zeroes: sed -e 's/^0*//' Show Sample Output


    5
    sed -e 's/ .*//' -e 's/\.//' -e 's/^0*//' /proc/loadavg
    flatcap · 2014-04-18 19:12:05 3
  • helps you keep watch on the load of a system, without having to stare constantly at the terminal. The -d argument to watch highlights the difference from the last run, making it easier to note how the load is fluctuating. The sed command just strips off the information about how long the box has been up, and how many users are logged in. Show Sample Output


    2
    watch -n 7 -d 'uptime | sed s/.*users,//'
    detert · 2009-03-25 02:52:36 0
  • When nvidia-settings gets itself into a funk and displays the error "Unable to load X Server Display Configuration page", then use this script to make it reset itself. reference: http://ubuntuforums.org/archive/index.php/t-1047029.html Show Sample Output


    0
    nvidia-settings -a AssociatedDisplays=0x00010000
    sharkyo · 2011-02-11 22:56:37 0

What Others Think

to have a rounded number of stars change it to be while [ true ]; do cat /proc/loadavg | perl -ne 'm/(^[^ ]+)/; $L = $1; $s=0.5 + $L; print "*" x $s; print " $L\n";' ; sleep 6; done
t3o · 31 weeks and 4 days ago
doracheats.com
kannuk5 · 30 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: