DELAPARRA
Index
Color
NL
Category: CLI commands

pwd

Explained by Updated

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.

Definition source Coders Lingo, CC BY 4.0

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

CategoryCLI commands
Explained by
Updated

More CLI commands terms

All terms starting with P

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.