Where to Go from Here

This crash course in Unix should give you a first helping of guidance—enough to perform some genuinely useful tasks in Mac OS X, and to acquire a feeling for how Unix commands work.

There’s a lot more to learn, however. As you peruse beginner-level Unix books and Web sites (see Appendix E), for example, you’ll gradually become familiar with a variety of important terms and tools.

Aliases

Don’t be confused: Aliases in Unix have nothing to do with traditional Macintosh icon aliases. Instead, Unix aliases are more like text macros: longish commands that you can trigger by typing a much shorter abbreviation.

For example, remember the command for unlocking all the files in a folder? (It was sudo chflags -R nouchg [pathname]. To unlock everything in your account’s Trash, for example, you’d type sudo chflags -R nouchg ~/.trash.)

Using the alias command, however, you can create a much shorter command (unlock, for example) that has the same effect. (The alias command takes two arguments: the alias name you want, and the command it’s supposed to type out, like this: alias unlock sudo chflags -R nouchg ~/.trash.)

On the down side, aliases you create this way linger in Terminal’s memory only while you’re still in the original Terminal window. As soon as you close it, you lose your aliases. When you get better at Unix, therefore, you can learn to create an aliases.mine file that permanently stores all your command aliases.

Get Mac OS X: The Missing Manual, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.