The pwd Command

The pwd command reports the full path to the current directory.

The current directory is the directory in which a user is currently operating while using a command line interface. A command line interface is an all-text display mode and it is provided via a console (i.e., a display mode in which the entire screen is text only) or via a terminal window (i.e., a text-only window in a GUI).

The full path, also called an absolute path, to a directory or file is the complete hierarchy of directories from the root directory to and including that directory or file. The root directory, which is designated by a forward slash (/), is the base directory on the filesystem (i.e., hierarchy of directories), and it contains all other directories, subdirectories and files on the system. Thus, the full path for any directory or file always begins with a forward slash.

pwd is one of the most basic commands in Linux and other Unix-like operating systems, along with ls, which is used to list the contents of the current directory, and cd, which is used to change the current directory.

pwd's syntax is

pwd [option]

Unlike most commands, pwd is almost always used just by itself, i.e.,


That is, it is rarely used with its options and never used with arguments (i.e., file names or other information provided as inputs). Anything that is typed on the same line after pwd, with the exception of an option, is ignored, and no error messages are returned.

As an example, if a user with the username janis is in its home directory, then the above command would typically return /home/janis/ (because, by default, all home directories are located in the directory /home). Likewise, if a user were currently working in directory /usr/share/config (which contains a number of program configuration files), then the same command would return /usr/share/config.

pwd is useful for confirming that the current directory has actually been changed to what the user intended after using cd. For example, after issuing the cd command to change the current directory from /home/janis to /usr/share/config, pwd could be used for confirmation; that is, the following sequence of commands would be issued:

cd /usr/share/config/


The standard version of pwd has a mere two options, both of which are employed only infrequently. The --help option is used as follows:

pwd --help

This option displays information about pwd, of which there is very little because it is such a simple command (i.e., it only has two options and accepts no arguments).

The other option is --version, which displays the version number, i.e.,

pwd --version

Although it is often thought of as standing for present working directory, pwd is actually an acronym for print working directory. The word print is traditional UNIX terminology for write or display, and it originated when computer output was typically printed on paper by default because CRT (cathode ray tube) display monitors were not yet widely available.

Despite its extreme simplicity, pwd remains one of the most useful and popular of the commands for Unix-like operating systems. Actually, this simplicity is completely consistent with the Unix philosophy, which emphasizes small, specialized and modular programs rather than the large and complex programs that are favored by some other operating systems.

Created January 11, 2005. Updated September 23, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.