Previous Table of Contents Next


Module 111
pwd

DESCRIPTION

The pwd command displays the full path of your present working directory. The present working directory is often referred to as the current working directory or current directory. Since the command that returns the present working directory is "pwd," we will refer to it as such. The csh uses the "cwd" variable to store the name of the current working directory. But it uses the pwd command to display the contents of the variable.

COMMAND FORMAT

The format of the pwd command follows.

     pwd

FURTHER DISCUSSION

The UNIX System has file systems that are hierarchical tree structures containing directories and files. The system administrator created a directory somewhere in this hierarchy. When you log in you are positioned at this directory, known as your login or HOME directory. Since this is your home directory, you own it and all the files under it. Therefore, you have full permissions to read, write, create, change, or delete the contents of your home directory.

The pwd command is an alias command and an external command. The alias for pwd is "print - $PWD." The external command is located in /bin/pwd. Both of these commands perform the same function. The main difference is the internal pwd command executes much faster than the /bin/pwd command.

RELATED COMMANDS

Refer to the cd command described in Module 14.

RELATED FILES

The pwd command sends its output to the standard output.

APPLICATIONS

The pwd command is used to display where you are currently located in the file system hierarchy. It is used as a check for the cd command. You may not remember which directory you are in, and pwd will tell you. Once you cd to a new directory you use pwd to show the new path.

TYPICAL OPERATION

In this activity you use the pwd command to display your HOME directory and then, using cd to move, you display your parent directory. Begin at the shell prompt.

1.  Display your present working directory by typing pwd and pressing Return.
     cj> pwd
     /u1/ts/mylogin
2.  To change the present working directory type cd .. and press Return. Notice that no response is given. If the cd command worked, the directory change was successful.
3.  Display the present working directory by typing pwd and pressing Return. Notice you have moved up the directory path one position. The ".." refers to the previous or "parent" directory in the present working path.
     cj> pwd
     /u1/ts
4.  To return to your home directory type cd and press Return.
5.  Turn to Module 110 to continue the learning sequence.


Previous Table of Contents Next