How to Print the Current Working Directory Using the pwd Command in Ubuntu Linux

Navigating the Linux file system through the command line is like walking through a massive, invisible maze. Unlike a graphical user interface (GUI) like Windows File Explorer, the terminal does not always give you an obvious, visual map of exactly where you are located. If you have been executing multiple cd (change directory) commands, moving deep into complex nested folders, it is incredibly easy to lose track of your location. To instantly figure out exactly where you are, you must rely on the fundamental pwd command.

What is the pwd Command?

The pwd command stands for Print Working Directory. It is one of the most basic, essential, and frequently used commands in the entire Unix/Linux ecosystem. It performs exactly one task: it outputs the full, absolute file path of the folder you are currently operating within, starting all the way from the root directory (/).

How to Use the pwd Command

Using the command requires zero configuration or additional flags.

  1. Open your Ubuntu terminal.
  2. Ensure your cursor is at the command prompt.
  3. Type the following three letters: pwd
  4. Press Enter.

The terminal will instantly print your absolute path on the next line. For example, if you are currently inside a folder called “Documents” within your personal user account, the output will look something like this:

/home/username/Documents

This string tells you exactly where any new files you create will be saved, and where any commands you execute will be applied by default.

Why Not Just Look at the Prompt?

You might wonder why pwd is necessary when many modern Linux terminal prompts already display the name of the current folder. For example, your prompt might look like this:

user@ubuntu:~/Documents$

While this is helpful, it is often misleading.

  • Relative vs. Absolute: The prompt often uses relative shorthand. The tilde symbol (~) represents your home directory. If you need to copy a file path into a configuration script, you cannot use the tilde; you need the full, absolute path starting from /, which only pwd provides.
  • Hidden Depths: If you are inside a folder named “config”, the prompt might just say config$. But is that /etc/config or /home/user/.local/config? The pwd command eliminates the ambiguity by giving you the entire string.

Resolving Symbolic Links

Linux heavily utilizes symbolic links (shortcuts that point to other directories). By default, if you navigate into a folder through a symbolic link, pwd will print the path including the shortcut name. This is usually what you want.

However, if you want to know the true, physical location of the folder on your hard drive, ignoring any shortcuts you took to get there, you can use the physical flag:

pwd -P

This forces the system to resolve any symbolic links and print the actual physical path where the data resides.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.