pwd Command

Purpose

Displays the path name of the working directory.

Syntax

pwd [ -L | -P ]

Description

The pwd command writes to standard output the full path name of your current directory (from the root directory). All directories are separated by a / (slash). The root directory is represented by the first /, and the last directory named is your current directory.

Flags

-L
Displays the value of the PWD environment variable if the PWD environment variable contains an absolute path name of the current directory that does not contain the file names . (dot) or .. (dot-dot). Otherwise, the -L flag behaves the same as the -P flag.
-P
Displays the absolute path name of the current directory. The absolute path name displayed with the -P flag does not contain file names that, in the context of the path name, refer to files of type symbolic link.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion.
>0 An error occurred.

Examples

Entering:

pwd

displays the current directory as:

/home/thomas

Files

Item Description
/usr/bin/pwd Contains the pwd command.