Mac OS X Hints

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

1 2 3 Page 2
Page 2 of 3

Unix Tip of the Month: Images Are Everything

OS X is a treasure trove of hidden icons and images that you can use for everything from presentations to folder icons to desktop pictures. Hunting for these hidden images, however, can be frustrating. Most are stashed within an application’s bundle, or in hidden Unix directories—neither of which is easily searchable from the Finder. And that’s where Terminal comes in handy.

Your first step is to make sure that Unix knows where on your system all the files are. A Unix program called locate creates a list of files on your machine and allows you to search that list, and it runs automatically at regular intervals—if you leave your Mac on all the time. To update the file list by hand, open Terminal and type

sudo /usr/libexec/locate.updatedb
, press return, enter your admin password, and go grab a snack—the update will take several minutes to run.

The key to treasure hunting with locate is to combine it with grep, a Unix program that matches patterns in text strings, such as file names and directory paths. Say you want to find all the TIFF images related to Apple’s iSync application. Just type

locate ".tiff" | grep "iSync" | more
and press return. This complex search command is actually relatively simple. First, locate is used to find all .tiff files on your machine. That long list, which you won’t see, is then sent (via the Unix pipe symbol) to grep, which looks for the word iSync. Finally, those results are sent to the program more, which does nothing more than pause the output after each screenful. Presto, you’ve got an instant list of every TIFF file related to iSync. To open any of the images in Preview, copy and paste an entire row from the list in Terminal with the command
	open "
. Press return, and the image opens in Preview.

There’s additional syntax for the locate program that’s very useful. If you run

locate \\* | more
, you’ll see the entire contents of the locate file. This will help you overcome a key limitation of locate—the fact that it’s case sensitive. So a search for .TIFF will find different files than a search for .tiff. To work around this case sensitivity, you can use the
command, which lets you ignore case. Say you’re looking for folder icons in the System folder. You’re not sure exactly how these icon files are named, but you’re guessing that they have folder somewhere in their names. Try this command to see them all:

locate \\* | grep -i "folder" | grep -i ".icns" | grep -i "System" | more

This is the same as the first example, except it takes a few more trips through grep. First, you’re searching the entire file for folder, with the

flag, which tells grep to ignore case when searching. This list is then searched for .icns, again in a case-insensitive manner. Finally, the command finds any remaining lines that contain System, this time paying attention to case, since you want to search the System folder.

Check It Out: “Wreck a Nice Beach” in Less Space

If the title of this tip makes no sense to you, it may help to know that part of it was in the code name for the Apple project that added speech recognition to Mac OS—just say the part in quotation marks quickly, and you’ll see why.

In any event, if you use speech recognition, you’re quite familiar with the floating bubble that lets you manage the process. Unfortunately, if you’re working on a small screen, the bubble often winds up exactly where you don’t want it to be. But it doesn’t have to be that way. You can minimize the speech bubble. Just double-click on the gray-lined area just below the middle, and the bubble will glide into the Dock.

Don’t worry—speech recognition will work just as it did before. In fact, the docked icon updates when you press the speech-activation key and speak.

A few Unix commands can help you quickly find hidden treasures in OS X, such as this list of folder icon files in the System folder.
1 2 3 Page 2
Page 2 of 3
Shop Tech Products at Amazon