O'Reilly logo

Beginning Mac OS® X Programming by Drew McCormack, Michael Trent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.2. Unix Basics

The Unix philosophy, which Mac OS X shares at its lower levels, can be summarized by the old adage that many hands make light work. Unix systems are full of commands—small programs that are highly specialized. Each command does one thing, and does it well. Even though the foundations are simple, you can achieve powerful tasks by combining Unix commands. This section covers basic aspects of Unix, some of the most important Unix commands, and how you can combine them to achieve your objectives.

11.2.1. Paths

Much of the time spent interacting with an operating system involves working with files and directories (that is, folders). You have to be able to locate files, view or edit them, move them, remove them, and so forth. But all these actions require that you be able to stipulate to the operating system which file or directory a particular action involves. In Finder, you can select a file and drag it to the Trash if you want to remove it. On the command line, there are no file icons; so you need to give a path to any file or directory you want to use in a command.

Unix paths can take one of two forms: absolute paths and relative paths. Absolute paths are spelled out in full with respect to the root directory. An absolute path begins with a forward slash, as in the following:

cd /Users/terry/Desktop

This line uses the cd command, which changes the current working directory of the shell. The current directory is set to the Desktop folder of user terry. The path ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required