Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Use pwd to print the absolute path of your current working directory. It does not change directories. Add -L to request a logical path that may retain symbolic-link names, or -P for a physical path with symbolic links resolved. Which result you get can depend on whether your shell runs its own pwd builtin or an external utility.
What does pwd do?
The name stands for “print working directory.” The command reports the directory the shell is currently using; it is useful for checking where you are before running commands or for saving the path for later use. GNU Coreutils describes it as printing “the name of the current directory.” GNU Coreutils: pwd invocation
To move to a different directory, use cd; pwd only displays the current location. The examples below use standard shell syntax and document the command’s behavior; they are not claims about testing in a particular Linux distribution.
Free tools Windows power users keep installed
One-click scans. No signup required.
15 practical pwd examples
Print and choose a path format
-
Print the current directory:
pwd -
Request the logical path:
-Lmay preserve symbolic-link names in the path.#1 Best Overall
pwd -L -
Request the physical path:
-Presolves symbolic links to the actual directory names.pwd -P -
Use GNU’s long option for logical output:
pwd --logical -
Use GNU’s long option for physical output:
pwd --physical -
Supply both modes, with physical last: for GNU
pwd, the last of-Land-Pwins.pwd -L -P -
Reverse the option order: logical mode is last, so GNU
pwduses it.Recommended Free Tools
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.pwd -P -L
Change location, then check it
-
Move to
/tmpand print the new location:cd /tmp pwd -
Move to the parent directory and check:
..refers to the parent of the current directory.cd .. pwd -
Move to your home directory and print its current path:
cd ~ pwd
Choose the implementation or use the output
-
Run Bash’s builtin explicitly in physical mode:
builtin pwd -P -
Run Bash’s builtin in logical mode:
builtin pwd -L -
Invoke the external command through
env: GNU documents this form to avoid shell aliases and builtin functions.Rank #4
env pwd -P -
Store the output in a shell variable: command substitution captures the output for a later command.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.current_dir=$(pwd) printf '%sn' "$current_dir" -
Use the exit status in a conditional: success runs the message; a failure skips it.
Best Value
if pwd >/dev/null; then printf '%sn' 'Current directory is available' fi
When should you use pwd -L or pwd -P?
Choose based on whether the route used to reach the directory matters or whether you need the resolved filesystem path.
- Use
pwd -Lwhen you want the logical path, which can preserve the name of a symbolic-link route. GNUpwduses thePWDenvironment value only if it is a valid absolute path without.or..components; otherwise, it falls back to physical handling. - Use
pwd -Pwhen you need the path with symbolic links resolved to actual directory names.
GNU pwd defaults to physical output unless POSIXLY_CORRECT is set. Bash documents its builtin’s default as physical unless set -o physical is enabled. Because defaults and behavior depend on the implementation, scripts that need a specific path format should state -L or -P explicitly. See the GNU Coreutils documentation and the Bash Reference Manual.
Is pwd a shell builtin or an external command?
It can be either. Bash provides pwd as a builtin, while GNU Coreutils also provides an external pwd utility. An unqualified pwd may therefore run a shell builtin, and shell aliases or functions can also affect what a command name invokes. In Bash, use builtin pwd to request the builtin; use env pwd to invoke the external utility without a shell alias or builtin function taking precedence.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →What happens if pwd fails?
On success, pwd returns status zero; failure returns a nonzero status. Bash documents errors determining the directory and invalid options as cases that produce a nonzero return. You can use that status in a conditional, as in example 15. The Bash builtin’s documented behavior is in the Bourne Shell Builtins reference.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

