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):

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

This provides me with a "snapshot" of what's happening on my machine. Basically,
my GeekTools setup is:
- 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}' - 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"}' - 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
- 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'`
- 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.
- 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
- 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.
Update-2007-03-19: Several people mentioned conky, torsmo, and roottail as being linux equivalents (and possible influences on GeekTool).

