cd command
Change the current working directory.
- Files & directories
- Package shell builtin
- 4 options · 6 examples
Syntax
cd [directory]Provided by the shell builtin package. Run man cd for the full manual.
Common options
| Option | What it does |
|---|---|
~ | Your home directory (also plain cd) |
- | The previous directory |
.. | The parent directory |
-P | Resolve symbolic links to the physical path |
Examples
Go to your home directory
cdGo to the parent directory
cd ..Go back to the previous directory
cd -Go to an absolute path
cd /var/www/htmlGo two levels up
cd ../..Path with spaces
cd "My Documents"
No example matches. Check the options table or search the guides.
Tips
- Run
pwdto print where you are.
cd guides
- cd command in Linux with Examples Linux Commands · Updated Apr 2025
