Further to my previous post on how to get BBC weather feeds on your desktop, this article collects together other scripts for GeekTool I've come across and customized (hat tip to the original sources, which I neglected to record). Who says the command line doesn't have equal status alongside the Mac OS X eye candy? Suggestions for optimization/ improvement or additional useful scripts most welcome.
Creating headings
Create headings using an echo shell command, just as when using PHP. For example:
echo " //UPTIME:"
Within GeekTool you can specify a custom font face, colour and opacity, text alignment, accompanying icon, refresh time, and whether the output should be "on top" of other windows—as for any of the following shell commands:

Reporting system uptime
The following shell command will report system uptime:
uptime | awk '{sub(":", "h ", $3); sub(",", "min", $3); print "Time since last system boot: " $3}'

Monitoring memory usage
Does you Photoshop work or toying in Parallels merit investment in additional RAM? The following shell command will allow you to monitor memory usage, showing the total RAM in use and top running processes (the window is sized so that the top 10 are visible):
uptime | top -l 1 | awk '/PhysMem/ {print "RAM in use: " $8 " \n"}'; top -ocpu -FR -l2 -n20 | grep '^....[1234567890] ' | grep -v ' 0.0% ..:' | cut -c 1-24,33-42,64-77

Identifying CPU hogs
Why is that non-essential utility app you just installed consuming 97% of your CPU cycles? The following shell command will allow you to monitor how much of you CPU is being overrun by the various apps you have running (those background processes in particular can be a surprise). Again the GeekTool window is sized to show the top 10 items:
uptime | top -l 2 | awk '/CPU usage/ && NR > 5 {print $6, $7="usage:", $8, $9="user,", $10, $11="sys,", $12, $13, "\n"}'; ps -Aro %cpu,ucomm,user

Keep an eye on available storage and mounted volumes
Nice and simple this one:
df -H -l

Network IP address and server status
First create a script command linking to a file called "ipadd.bash":
bash /Users/bruce/Documents/GeekTool/ipadd.bash
Save the following script to ipadd.bash (be sure to uncheck the .txt file extension if using TextEdit):
#! /bin/bash
myvar1=`system_profiler SPAirPortDataType | grep -e "Current Wireless Network:" | awk '{print $4}'`
myvar2=`system_profiler SPAirPortDataType | grep -e "Wireless Channel:" | awk '{print $3}'`
echo "External:" `curl -s http://checkip.dyndns.org/ | awk '{print $6}' | cut -f 1 -d "<"`
myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'| grep -v inet`
if [ "$myen0" != "" ]
then
echo "Ethernet: $myen0"
else
echo "Ethernet: INACTIVE"
fi
#myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'| grep -v inet`
#if [ "myen1" != "" ]
#then
#echo "AirPort: $myen1 [$myvar1 : CH.$myvar2]"
#else
#echo "Airport: INACTIVE"
#fi
I've commented out the AirPort section, since this is not installed in my machine following a hardware failure. You can uncomment this to display your wireless connectivity
Your external (router) IP and internal (LAN) IP addresses should be displayed as below. In order to check whether your own or a third-party server is reachable, try this script which outputs the title of the index page. No output implies no contact with the server:
curl -s www.bioneural.net | perl -nle 'print for m:<title>(.*)</title>:'
You can make this a bit more visual by using an icon in GeekTool, where green means "up" and red means "unreachable":
![]()
The final result? Something like this:

Reviewing your logs
GeekTool can also dump the contents of text files to screen, such as various OS X and application logs:

Did your last time machine backup complete successfully? The system log will tell you:

Have you downloaded and installed Apple's most recent OS X update already? It's easy to check what versions you have:

Displaying the firewall log might satisfy a paranoid itch:

Embed a world clock in your desktop
If you want to know when it's safe to phone family or friends abroad, your desktop can tell you. Here are a few examples:
TZ=England/GMT date +"London:%l:%M %p on %d %B"
TZ=Germany/GMT-1 date +"Frankfurt:%l:%M %p on %d %B"
TZ=Australia/GMT-11 date +"Melbourne:%l:%M %p on %d %B"
TZ=NewZealand/GMT-13 date +"Wellington:%l:%M %p on %d %B"
These can be geo-located if you happen to use a world map as your desktop background:

Look forward to your next holiday
As a visual reminder of your next trip abroad, you might place a graphic reminder on your desktop (e.g. a beach photo). Alternatively, if you are using a map background, you might overlay an icon to indicate your destination:
![]()
For example:
![]()
Display local weather conditions
See here.
S.M.A.R.T. status
Self-monitoring, analysis, and reporting technology (S.M.A.R.T.) can sometimes predict drive failures. You can monitor drive verification using the following shell command in conjunction with an icon (gree = verified; red = not verified):
diskutil info disk0s2 | grep Verified > /dev/null
Notice that my USB external drive does not support S.M.A.R.T., so appears unverified:

Calendar
The following scripts in conjunction with positioning and typography allow you to build a custom desktop calendar. Time:
date "+%l:%M %p"
Day:
date +%A
Month:
date +%B
Date:
date +%d
The end result might be something like this:

To vary the display layer order of overlapping entries within a group, drag individual entries up and down the group list so that the top-most entry sits above lower layer entries.
Display currently playing iTunes track
While you can use GeekTool in conjunction with AppleScript to output the currently playing track in iTunes to your desktop, a seemingly popular alternative is the Bowtie utility. Bowtie additionally allows you to control iTunes and in theory can submit your tracks to Last.fm (this refuses to work for me). I am using Bowtie along with the discreet Subtitle theme:

Growl
Growl is a notification system supported by a number of popular Mac applications (e.g. NetNewsWire, Skype, Firefox, Transmit, etc.), and is installed as a Preference Pane. Growl allows for applications you have open and performing background tasks (for example) to get your attention without intruding on your current activity:












I'm speechless... just my kind of stuff, but yet I haven't dived into it. Now it's just c-n-p. :-P Thanks a bunch, Bruce!
@BOK: Looking forward to see the results of your customization effort in due course ;-) Be sure to upload a capture to Flickr tagged 'geektool'!
Wow, great article! Thanks for all the tips!
Used the lynx technique described in the article to display my last 10 played songs on last.fm
don't forget the last.fm username...
Hey thanks for sharing Iain :-)
I was just wondering if there is a way to display the days along with hours and mins with uptime command?
@Jason, see here.