linux/pwd

Print Working Directory

Display the full path of the current working directory.

filesystem
navigation
basic
linux

Command

pwd

Explanation

`pwd` stands for 'print working directory'. It helps users confirm their current location in the filesystem. It resolves symbolic links and shows the full, absolute path of the directory you are currently in.

Common Use Cases

  • Check your current directory before running file operations
  • Confirm absolute paths for scripting
  • Debug navigation errors in scripts

Best Practices

  • Use `pwd` before operations like `cp`, `mv`, or `rm` to avoid mistakes
  • Combine with `cd` in scripts to log current locations

Common Mistakes to Avoid

  • Confusing relative and absolute paths
  • Using `pwd` inside scripts without handling symbolic links properly

Troubleshooting

Problem: Shows unexpected path due to symbolic link

Solution: Use `pwd -P` to print the physical path without symbolic links.

Examples

Show current directory path

pwd