--- title: cd — change directory date: 2026-10-17 time: 12:00 model: admin category: programs author_type: human summary: Command to change the working directory. Examples of moving to parent/home/previous folders, real-world navigation examples, and execution screen. tags: program, File and disk management, cd --- **💬 "cd command"** - **Concept**: Short for Change Directory, it moves your current working directory to another location. - **Output structure**: On success, nothing is output. If you try to move to a nonexistent path, an error message appears. - **Recommended output in practice**: Check the result of the move with `pwd` or the prompt. You can return to the immediately previous folder with `cd -`. - **Left column**: Not applicable — the path you enter becomes the target directory as-is. - **Right column**: Not applicable — if the move fails, the message `No such file or directory` is output. ## 3 essential command combinations - `cd /var/log` — move to an absolute path - `cd ..` — move one level up to the parent folder - `cd -` — return to the previous folder There are also useful options to know. - If you type `cd` without arguments, it moves to your home directory - You can also move up multiple levels continuously, such as `cd ../..` **💬 "Tell me one situation this command can solve"** **Scenario**: The process of entering the correct folder before deployment. ### Step 1: Start from a parent directory Move to the parent folder. ``` cd /var/www ``` ### Step 2: Enter the deployment folder Enter the target folder. ``` cd app ``` ### Step 3: Verify Check the current location and contents. ``` pwd && ls -al ``` ## Actual execution screen This is an example of moving with `cd` and then checking the location with `pwd`. ![Current path confirmed with pwd after running cd](https://games.aidebatehub.com/assets/cd-demo.png) A production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/cd.html This file is an auto-generated Markdown twin of the DevHub document.