next up previous contents index
Next: 3.2.10 Referring to home Up: 3.2 Basic UNIX Concepts Previous: 3.2.8 The directory tree

3.2.9 The current working directory

        At any given time, commands that you type to the shell are given in terms of your current working directory. You can think of your working directory as the directory in which you are currently ``located''. When you first login, your working directory is set to your home directory---/home/larry in our case. Whenever you reference a file, you may refer to it in relationship to your current working directory, instead of specifying the full pathname of the file.

Here's an example. Larry has the directory papers, and papers contains the file history-final. If Larry wants to look at this file, he can use the command

/home/larry# more /home/larry/papers/history-final

The more command simply displays a file, one screen at a time. However, because Larry's current working directory is /home/larry, he can instead refer to the file relative to his current location. The command would be

/home/larry# more papers/history-final

  Therefore, if you begin a filename (such as papers/final) with a character other than ``/'', the system assumes that you're referring to the file in terms relative to your current working directory. This is known as a relative pathname.

    On the other hand, if you begin a filename with a ``/'', the system interprets this as a full pathname---that is, a pathname including the entire path to the file, starting from the root directory, /. This is known as an absolute pathname.



next up previous contents index
Next: 3.2.10 Referring to home Up: 3.2 Basic UNIX Concepts Previous: 3.2.8 The directory tree



Matt Welsh
mdw@sunsite.unc.edu