Shell
pwd
Print the current working directory.
directorypathnavigationshell
Additional Notes
pwd prints the directory your shell is currently working in. The name means print working directory.
It is simple but important. Before deleting, moving, copying, or editing files, pwd helps confirm where you are.
Syntax
pwd [options]
Parameters
options: Flags that change howpwdbehaves.arguments: Values consumed by the shell builtin or script command.command: Command line to run, test, wrap, or control.
Common Options
-L: Print the logical path, using symbolic links as the shell sees them.-P: Print the physical path, resolving symbolic links.
Examples
pwd
Show the current directory.
cd /var/log
pwd
Move somewhere, then confirm the new location.
pwd -P
Show the physical path with symlinks resolved.
Practical Notes
- Use
pwdbefore dangerous commands likerm,chmod -R, orchown -R. - The current directory affects relative paths.
pwdis often a shell builtin, but/bin/pwdmay also exist.- In scripts,
pwdhelps build absolute paths from relative work.