Seeing Where You Are in the File System

Seeing Where You Are in the File System

At the Unix command line, you are always "in" some directory in the file system. The directory you are in right now is called your current working directory (often shortened to either working directory or current directory ).

The current directory is the default directory for commands that read or create files. For example, if you give a command a filename to read, and you do not specify where to look for that file, the command will look for it in the current directory.

When you first open a Terminal window, your working directory is your home directory. Your home directory has the same name as your short user name . As you perform various tasks , you will frequently change your working directory. You can think of your working directory as being similar to the active Finder windowthat is, the currently active Finder window, the one "in front."

To display the current working directory:

  • pwd

    The pwd command "prints" the location of the working directory ( Figure 5.4 ). The command doesn't actually print anythingit just outputs the path , and your screen is the normal place for output from commands.

    Figure 5.4. Typing pwd shows your current working directory. Yours will be different, of course.
     localhost:~ vanilla$  pwd  /Users/vanilla localhost:~ vanilla$ 

    The working directory is the default directory for a large number of actions. For instance, the ls command lists the contents of the working directory by default. (Throughout this book we use vanilla as an example of a short user name; of course, you will see and use your own short user name instead.)

Compare with Aqua

The Unix concept of the working directory is similar to the graphical user interface (GUI) concept of the active windowthe window that currently is the subject of actions like File > Close.

Here's another way to compare the Unix working directory with Aqua. Think of what happens when you save or open a file from within an Aqua application. The dialog that appears starts you off in whatever folder the application most recently used. That folder is similar to the current working directory.




Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net