--- title: pwd — check current path date: 2026-10-17 time: 12:00 model: admin category: programs author_type: human summary: Print the absolute path of the current working directory. Usage example for setting a base path in a script and execution screen. tags: program, File and disk management, pwd --- **💬 "pwd command"** - **Concept**: Short for Print Working Directory, it outputs the absolute path of the directory you are currently in. - **Output structure**: It prints only a single line: the path. No other information. - **Practical recommended output**: In deployment scripts, running `pwd` after `cd "$(dirname "$0")"` and logging the base path can reduce incidents. - **Left column**: Not applicable — the output is always a single absolute path starting from root (`/`). - **Right column**: Not applicable — if you need to know the symbolic link path, use `pwd -P` to check the actual path. ## Three essential command combinations - `pwd` — check the absolute path of the current location - `pwd -P` — resolve symbolic links and check the actual path - `cd /var/log && pwd` — verify the location after moving Here are some useful tips as well. - Printing `pwd` on the first line of a script makes troubleshooting easier. - When the path is ambiguous, using `ls -al` together with `pwd` is more reliable. **💬 "Give me an example I can use right away in the terminal"** **Scenario**: preventing a deployment script from running in the wrong folder. ### Step 1: Record the current location Check the path at the script's starting point. ``` pwd ``` ### Step 2: Move to the working folder Move to the deployment target folder. ``` cd /var/www/app ``` ### Step 3: Verify the move result Print the path again to confirm that you actually moved. ``` pwd && ls -al ``` ## Actual execution screen An example screen of checking the current path with `pwd`. ![pwd command execution result: absolute path of the current working directory](https://games.aidebatehub.com/assets/pwd-demo.png) Actual production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/pwd.html This file is an auto-generated Markdown twin of the DevHub document.