Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

March 2007
Sun Mon Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Feb  Apr

Mac OS X GeekTool

Monday, March 19, 2007

If you read my posts for the lisp content or you don't have a Mac, you'll probably want to stop reading this post now. However, if you're a Mac user and you haven't discovered GeekTool yet, you might be interested in this one. ;-)

I recently discovered GeekTool, a utility that lets you display the text output (you can also display graphics) of different commands on your desktop. I've found this really useful for displaying a variety of different things that tell me a bit more about what's happening on my machine. There's a great Lifehacker introduction to GeekTools that explains more about what GeekTools is and how to set it up, so I won't go over that here. Suffice to say that GeekTools is one of those utilities that quickly becomes addictive. For example, I normally have a clean desktop on my Mac (no icons, hidden dock):

No GeekTool

However, when I enable GeekTool, I get the following on my desktop (click on the image for a higher resolution image):

GeekTool

This provides me with a "snapshot" of what's happening on my machine. Basically, my GeekTools setup is:

  1. In the upper-left-hand part of the screen, I'm displaying a line showing the uptime and memory summary (refreshed every 60 seconds). This is produced with the following:
    uptime | awk '{printf "Uptime: " $3 " " $4 " " $5 " " }'; top -l 1 |
    awk '/PhysMem/ {printf "RAM : " $8 ", " }' ; top -l 2 | awk '/CPU
    usage/ && NR > 5 {print $6, $7=":", $8, $9="user", $10, $11="sys",
    $12, $13}'
  2. Directly under #1, I display the disk usage summary (refreshed every 60 seconds). This is produced with the following:
    df -h | grep disk0s3 | awk '{print "Macintosh HD:", $2, "total,", $3, "used,", $4, "remaining"}'
  3. Under that is a list of the last 60 processes sorted in descending order by process id (refreshed every 10 seconds). This is produced with the following:
    top -n 60 -l 2 | tail -61
  4. Under that is my external IP address (refreshed every 300 seconds). This is produced with the following:
    echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`
  5. At the top-middle of the screen is a calendar (with the current date in parenthesis and a summary of 4 different iCal calendars (refreshed every 60 seconds). The Calendar was produced with a modified version of this script and the iCal output was produced with a modified version of this script.
  6. At the bottom-middle of the screen is the latest output to the system.log file (refreshed every 10 seconds). This is produced with the following:
    tail /private/var/log/system.log
  7. At the right of the screen is a summary of the processes using the most CPU, processes using the most CPU time, and processes using the most memory (refreshed every 60 seconds). This is produced with this script.
So, by turning on GeekTool, I get a quick snapshot of what's happening. Very addictive! Now, this is all information that you could get if you entered commands at a terminal or if you ran Activity Monitor; however, GeekTool provides a nice, quick way of looking at a lot of key information that helps you tell what's going on with your Mac. If anyone has any additional tips as to what output they would find useful in this type of display, I would be interested in hearing your ideas.

Update-2007-03-19: Several people mentioned conky, torsmo, and roottail as being linux equivalents (and possible influences on GeekTool).

emacs Copyright © 2007 by Bill Clementson