Specifications

Chapter 1 Introduction to the Command-Line Environment 15
Specifying Files and Folders
Most commands operate on les and folders, whose locations are identied by paths.
The folder names that make up a path are separated by slashes. For example, the path
to the Terminal application is /Applications/Utilities/Terminal.app.
Standard shortcuts used to represent specic folders are shown in the following
table. They are specied relative to the current folder, and can eliminate the need to
enter full paths.
Shortcut Description
. A single period represents the current folder.
For example, the string “./Test.c” represents the
Test.c le in the current folder.
.. Two periods represent the parent folder of the
current folder. For example, the string “../Test
represents a sibling folder (named Test) of the
current folder.
~[username] The tilde character represents the home folder
of the logged-in user. For example, to specify the
Documents folder, of the current user, you would
specify ~/Documents. To specify another users
Document folder you would use their short name
preceded by the tilde (~) character—for example,
~jsmith/Documents. In Mac OS X, this folder is
in the local /Users folder or on a network server.
For a list of all the short names on your system,
type
dscl . -list /Users. Most of these
users aren’t traditional user accounts with home
directories, but you should be able to nd the
short name of known users on the computer.
File and folder names can include letters, numbers, a period, or the underscore
character. Avoid most other characters, including space characters. Although some
Mac OS X le systems permit the use of these other characters, including spaces,
you might need to add single or double quotation marks around pathnames that
contain them.
For individual characters, you can also escape” the character—that is, put a backslash
character immediately before the character in your string. For example, the pathname
My Disk is “My Disk” or My\ Disk.