macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

An Introduction to Tiger Terminal
Pages: 1, 2, 3

Animate Your Desktop and Then kill It

Here's a fun trick to do with the Terminal that affects the GUI--the famous animated-desktop trick. In this Terminal hack, you can change your desktop from a static picture to an animation. Along the way, we'll learn a trick to save on long typing (and typos).



Go to the Finder and then to the Screen Saver preferences pane. Select an animated screen saver; the new RSS Visualizer included in Tiger is a good choice for this exercise. Mine is set for Slashdot RSS. (Did my latest review get accepted yet?)

Now, you have a couple of choices. You can type in this loooong command:

tigerbeta:~ tigerbeta1$ /System/Library/Frameworks/
ScreenSaver.framework/Resources/ScreenSaverEngine.app/
Contents/MacOS/ScreenSaverEngine -background

Note: There is one space before the -background (dash background). There are no other spaces in the entire command line.

or you can copy and paste the above command (cheater);

or you can use the Finder for a little help:

  1. Open a new Terminal window.

  2. Go back to the Finder and follow the path above up to ScreenSaverEngine.app.

  3. Drag this app to your open Terminal window and drop it at your waiting command-line prompt.

  4. Type (or copy/paste) in the last bit: /Contents/MacOS/ScreenSaverEngine -background

  5. Hit Enter.

  6. Hit F11 and look at your desktop!

One caveat is that this takes up a huge amount of processing power. Open a new Terminal window and type top and hit the Enter key. top gives a dynamic display of every program and background operation currently running by descending PID (Process ID) order. You'll see that the screensaver app is taking at least 10 percent of your system's attention.

To end the process, go back to the Terminal, where the desktop animation is still executing, and hit Control-C (^C). If the app turns psycho and won't quit, you can kill it using top and the Terminal. In the example below, the PID of the screensaver app is 223:

To kill the offending application is the equivalent of using the Force Quit command in the Finder:

tigerbeta:~ tigerbeta1$ kill 223
tigerbeta:~ tigerbeta1$

If the process still won't quite, enter kill -9 PID (the -9 signal means "non-ignorable" or "I really mean it!"):

tigerbeta:~ tigerbeta1$ kill -9 223
tigerbeta:~ tigerbeta1$

Empty the Trash

A common problem many users experience at one time or another is a file stuck in the trash that can't be deleted. An easy fix is to use the Terminal:

tigerbeta:~ tigerbeta1$ sudo chflags nouchg ~/.Trash/*
Password:
tigerbeta:~ tigerbeta1$

The nouchg option to the chflag command ("change file flags") unlocks the file. The nouchg keyword is actually the word no in front of the uchg option ("set the user immutable flag") so no turns the option off. You should now be able to delete everything in the Trash normally.

Conclusion

There are many things the Finder is good at and certainly for many users, a trip to the Terminal is a scary prospect. But I hope this article introduces some useful (and fun!) things the Terminal can do for you that give you some courage to try out more advanced commands.

Mary Norbury-Glaser is the IT director at a University of Colorado affiliate center. She has over 15 years of experience in cross-platform systems administration in the education sector. She loves fast cars and geocaching.


Return to MacDevCenter.com.