On Unix-like operating systems, the pwd command outputs the name of the working directory.
This page covers the GNU/Linux version of pwd.
Description
The default behavior of pwd is slightly different depending on if you are running the stand-alone command, or the built-in pwd command that is included in your shell. If you are using the bash shell, you can determine which pwd is the default with the type command:
- Description
- Syntax
- Examples
- Related commands
- Linux commands help
type pwd
pwd is a shell built-in
To specify that you want to run the stand-alone program instead of the shell built-in, use its complete path in the command:
/bin/pwd
This page describes the GNU/Linux stand-alone version of pwd.
Syntax
pwd [OPTION]…
Options
Examples
pwd
Print the name of the working directory. If any of the subdirectories in the path are symbolic links, and you used the symlink names when changing to the directory, the symlink names are printed. Example output:
/home/hope/mysymlink/mydir
pwd -P
Print the name of the working directory, using the actual names of the directory components, even if their symlink names were used when changing to the directory. Example output:
/home/hope/actual_directory_name/actual_subdirectory/mydir
Related commands
cd — Change the working directory.readlink — Print the value of a symbolic link or canonical file name.