Small List Of GeekTool Commands 29

Tip

Small List Of GeekTool Commands

Hey

I have a new love on my Mac. That is the application GeekTool. It combines my love of Terminal and my love of the Mac’s GUI. The idea behind GeekTool is to display text on your desktop so you can see useful pieces of information. I like it because I don’t have to keep using Terminal. If you want more information check out my review on iLoveMacApps.

This post will be dedicated to the small Terminal commands that you can use to get the most out of GeekTool. Some will be simple, some will be complicated, but they all help. These have been found all over the Internet, but me not thinking ahead I forgot to write down any links to the authors, if you are the original curator of the little piece of code, please leave a comment and I am sure I can link to your site.

Default Log

One of the best logs I find to have on your Desktop is the following. It shows you useful pieces of information with out random bits thrown in.

/private/var/log/system.log

View Top Output

There is a lot of ways to view the output of top. The Unix command to view the current CPU usage. To see which one you like run it through Terminal to see which results come out the best for you. Each new line is a separate different command.
top -n 60 -l 2 | tail -61
top -l1 -u -o cpu -S
top -ocpu -FR -l2 -n20 | grep '^....[1234567890] ' | grep -v ' 0.0% ..:' | cut -c 1-24,33-42,64-77

Notice that is a “ell” and then a one on the middle one. Funny code writing.

Uptime With Load

My favourite little tool is uptime. Simply because it output the load for you. With load you can tell how badly your computer is living.

uptime

Disk Usage

If you want to view how much disk usage you are taking up simply type the following. You may have to change disk0s2 to a different number depending on your configuration.

df -h | grep disk0s2 | awk '{print "Macintosh HD:", $2, "total,", $3, "used,", $4, "remaining"}'

IP Address

If you are on a dynamic IP address or you simply want to know your IP address, this sort of command is probably very useful.

echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`

Internal IP Address

Same as above although this will show you an internal IP.

ifconfig en1 | GREP inet

Current Calendar Month

Pretty simple, a small little calendar

cal

If you want the date you can always use:

date

Current Homeland Security Threat Level

If you want to know what level your Terrorism you are suffering you can check out the threat level of the homeland security website.

curl -s http://www.dhs.gov/dhspublic/getAdvisoryCondition | grep CONDITION

To be perfectly honest you might as well type:

echo "Elevated"

Because it isn’t going to change any time soon.

Get Server Information

If you have a webserver or other server you can get various pieces of information using SSH, items like top doesn’t seem to work to well although other basic commands do.

ssh name@123.123.123.123 'command1;command2;

Conclusion

Hopefully if you are new to Terminal and code bench some of those command would be useful to you. I did originally want to make this post a lot longer but due to work and other matters that were really out of my control I have had to cut it short. If you know of any more please leave a comment.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

29 Responses to “Small List Of GeekTool Commands”

  1. 1

    When I put in the first code – it said permission denied

    And I hope you feel better

    Jake

    Comment By Jke Speyer on October 22nd, at 4:23 am

  2. 2

    Are these commands supposed to run in GeekTool? But GeekTool only allow a string which is only for file path isn’t it?

    Or suppose I am to put the commands in a text file for GeekTool to use?

    Comment By ignis fatuus on October 22nd, at 9:26 am

  3. 3

    No, you simply change the drop down from file to shell and you can copy and paste the command straight in.

    @Jke, it sounds like a permissions error. It shouldn’t do that.

    Comment By admin on October 22nd, at 1:51 pm

  4. 4

    I can’t understand the thrill of using Terminal. That’s why I became a Mac user in the first place… because when I first started using computers back in the 1980′s the choice was either MSDos or Mac’s GUI OS and I thought that having to remember commands and computer code to do everything was so limited and frustrating that I became a Mac convert straight away. Now you getting all wet over typing in command lines. Talk about stepping back in time. Make using computers easier not harder. Cheers, the ANTI GEEK.

    Comment By Paulo on October 24th, at 6:09 pm

  5. 5

    I like commands because using them is actually easier. For the advance stuff it is a lot quicker to use Terminal than it is the GUI. No messing. Not everything I use Terminal for, just for getting some advance stuff done.

    Comment By admin on October 24th, at 6:11 pm

  6. 6

    External Ip…

    this works better for me…

    Echo External ip:; curl -s http://checkip.dyndns.org | sed ‘s/[a-zA-Z/ :]//g’

    Comment By David Cochran on February 14th, at 12:33 pm

  7. 7

    Getting the currently playing iTunes song up there would be nice.

    Comment By DreadedKilla on April 5th, at 8:02 am

  8. 8

    @DreadedKilla: To get the currently playing iTunes song through the command line, use Script Editor to write and save this script (in this case I saved it as “current_track.scpt”):

    tell application “iTunes”
    try
    if not (exists current track) then return
    set current_track_artist to (get artist of current track)
    set current_track_name to (get name of current track)
    return current_track_artist & “: ” & current_track_name
    end try
    end tell

    Next, enter “osascript current_track.scpt” to run the script file and have the output returned to the Terminal.

    Comment By Willem van Zyl on April 12th, at 9:10 pm

  9. 9

    @Willem van Zyl: I’ve tried it and all other hints for getting it up, but after having an icon show up, it’s always red and there is no info. Any troubleshooting tips?

    I’m running Mac OS X 10.5.6 on an early 2008 white MacBook with a 2.4GHz Intel Core 2 Duo processor and 2GB 667 MHz DDR2 SDRAM memory, running iTunes version 8.0 and the latest version of GeekTool, if that helps any.

    Comment By DreadedKilla on April 13th, at 3:11 am

  10. 10

    Your Terminal commands are very interesting. One I have already used is to change the screen capture format to JPG. Is there a command for deleting the “are you sure you want to …” message for shutting off the computer etc.? If I goof I can live with it.
    Does using terminal commands like this make me a Hacker? On my own computer only, of course Then I can call myself a 77 year old Hacker.!
    Let me know what the command is for getting rid of that annoying confirmation message
    Rod

    Comment By Rod Hake on May 11th, at 2:31 pm

  11. 11

    @Rod, these command don’t really make you a hacker. I can’t find one about shutting off your computer, although I will have a look.

    Comment By admin on May 11th, at 5:34 pm

  12. 12

    when i try to enable geektool it says”Preferences need to be updated, please launch Geektool Preferences”

    Comment By NAK0604 on May 29th, at 1:20 am

  13. 13

    and i am running the white macbook 10.5.7 and i have geektool 2

    Comment By NAK0604 on May 29th, at 1:21 am

  14. 14

    Uninstall and reinstall the preference pane is probably the quickest way.

    Comment By admin on May 29th, at 7:45 pm

  15. 15

    Great job! THANK YOU!

    Comment By Gertrude on December 4th, at 11:37 pm

  16. 16

    We need more posts like this!

    Comment By Daniel on December 5th, at 10:32 pm

  17. 17

    It didn’t work for me, can you give us some more information?

    Comment By Frankie on December 5th, at 10:50 pm

  18. 18

    Great Post !! thanx a lot :D

    Comment By richer on August 6th, at 11:39 pm

  19. 19

    cool. i need ideas from webmasters like your self to make my blogs up to par. excellent info, well developed.

    Comment By Chi Osias on October 24th, at 7:02 am

  20. 20

    This is totally cool, most especially the External IP script. Need more shell scripting posts like these. Is it possible to post a sreenshot of what your desktop looks like so we can get some ideas on how to get more creative?

    Comment By Sherry on November 3rd, at 8:20 pm

  21. 21

    Great post! Thanks man!

    Comment By Ahnaf on January 18th, at 8:10 am

  22. 22

    Hey there! This post couldn’t be written any better! Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this write-up to him. Pretty sure he will have a good read. Thanks for sharing!

    Comment By Myrtie Perrault on March 29th, at 11:13 pm

  23. 23

    Great blog here! Also your website loads up fast! What web host are you using? Can I get your affiliate link to your host? I wish my website loaded up as fast as yours lol

    Comment By Lynell Mattke on April 27th, at 1:14 am

  24. 24

    I found this command gets you to the more apple friendly version of disk size. Or more what your hard drive says. Also formats decimals

    df -h | grep disk0s2 | awk ‘{printf “Mac HD:%.0f Total: %.2f Used: %.2f \n”, (($2*1024*1024*1024)/1000/1000/1000), (($3*1024*1024*1024)/1000/1000/1000), (($4*1024*1024*1024)/1000/1000/1000)}’

    Comment By Nick P on May 30th, at 7:42 am

  25. 25

    Excellent beat ! I wish to apprentice while you amend your web site, how can i subscribe for a blog web site? The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear concept

    Comment By Homes For Sale in Kissimmee Florida on June 9th, at 4:12 pm

  26. 26

    Great blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple adjustements would really make my blog jump out. Please let me know where you got your design. Bless you

    Comment By Hello Kitty on June 28th, at 10:18 am

  27. 27

    I’m curious to find out what blog system you’re working with? I’m experiencing some minor security issues with my latest blog and I would like to find something more secure. Do you have any suggestions?

    Comment By Disney World Fastpass on June 30th, at 12:37 pm

  28. 28

    It used to show at the top of my start list until I downloaded google chrome to see what it was all about, I didn’t really like it so I deleted it but now firefox isnt at the top of start. Any ideas?.

    Comment By program do pitów on August 5th, at 8:28 pm

  29. 29

    Hmm, that is some compelling info youve got going! Makes me scratch my head and think. Keep up the good writing!

    Comment By ugg moccasins on August 22nd, at 4:58 am