pwd
What is pwd?
pwd: Print Working Directory — Show the full path of the current directory. pwd, print working directory, shows the full path of the folder you are in, such as /var/www/shop/storage. It sounds trivial, but on a server with many similar-looking projects, or after a few cd commands, it is easy to lose track. Checking pwd before running anything destructive, such as deleting files or running a migration, is a cheap safety habit.
Frequently asked questions about pwd
What should you keep in mind with pwd?
In scripts, the current directory depends on where the script was started from, not where the script file lives. That causes bugs when someone runs it from another folder. Use the script's own location instead, for example with $(dirname "$0") in Bash. Many shells can also show the current directory in your prompt, which removes the need to ask.
At a glance
| Category | CLI commands |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |