How to Use pwd Command in Linux: Simple Guide
The
pwd command in Linux shows the full path of the current working directory you are in. Just type pwd in the terminal and press Enter to see your current folder location.Syntax
The basic syntax of the pwd command is simple and has no required options.
pwd: Prints the full path of the current directory.pwd [options]: You can add options like--helpor--versionfor more info.
bash
pwd
Output
/home/username
Example
This example shows how to use pwd to find out which directory you are currently in.
bash
cd /usr/local/bin pwd
Output
/usr/local/bin
Common Pitfalls
Some common mistakes when using pwd include:
- Expecting
pwdto change directories — it only shows the current path. - Using
pwdinside scripts without checking if the directory exists. - Confusing
pwdoutput with relative paths; it always shows the absolute path.
bash
cd ..
pwd
# This shows the absolute path, not just '..' or relative pathOutput
/home/username
Quick Reference
Remember these quick tips for pwd:
- Use
pwdto see your current directory path. - It always prints the absolute path.
- No arguments are needed for basic use.
Key Takeaways
The
pwd command shows your current directory's full path.Simply type
pwd and press Enter to use it.It always outputs the absolute path, not relative paths.
pwd does not change your directory, only displays it.Use
pwd --help for more options and info.