The pwd command in Linux

pwd stands for "print working directory" and does exactly one thing: it prints the absolute path of the directory your shell is currently in. It sounds trivial, but it is the fastest way to orient yourself, and it matters in scripts, where knowing the current directory prevents files being created in the wrong place.

How pwd works

The kernel tracks each process's working directory as a reference to the directory itself, not as a text path. pwd's job is reconstructing the human-readable path — walking up parent by parent, or, in the common case, just printing the $PWD variable the shell maintains as you cd around.

That dual bookkeeping is where -L and -P come from. The shell's $PWD remembers the route you took, symlinks included (the logical path); asking the kernel and resolving every component yields the physical one. When a build tool and your prompt disagree about "where you are", you are standing inside a symlinked directory and seeing the two answers side by side.

Syntax

pwd

Common options

OptionWhat it does
-PPrint the physical path, resolving any symbolic links.
-LPrint the logical path, keeping symlinks as you traversed them (default).

How to use pwd: examples

$ pwd

Prints something like /home/user/documents — the full path from the filesystem root.

$ echo "You are in: $(pwd)"

Command substitution: use the output of pwd inside another command or script.

Real-world use cases for pwd

Confirming where a script runs

Cron jobs run from unexpected working directories (usually the user's home). Logging "$(pwd)" as the first line of a cron script is the fastest way to explain why its relative paths behave differently than in your terminal.

Copying the current path

You need to reference your current location in another terminal, a config file, or a message to a colleague. pwd prints the canonical absolute path, ready to copy — no reconstructing it from the prompt.

Try pwd yourself

This is a live sandbox with a small filesystem (documents/, notes.txt, backup.sh…). Nothing you do here can break anything — experiment freely. Try: pwd

Pro tips and common mistakes

Frequently asked questions about pwd

What does pwd stand for?

Print Working Directory. It prints the absolute path of the shell's current directory.

Is the prompt not enough to know where I am?

Many prompts show only the last folder name or abbreviate the path. pwd always prints the complete, unambiguous absolute path.

Related commands

ls

List the contents of a directory, with options for hidden files, long format, sorting and more.

cd

Move between directories: absolute and relative paths, home shortcut, and jumping back.

Want to build real fluency? The interactive course takes you through pwd and every other essential command with guided, checked exercises.