Change folders in Bash with cd
Jump to /, step up with .., and go home with ~ using the Bash cd command.
Start Interactive Lessoncd changes the folder you are standing in. In Bash, three shortcuts cover most day-to-day moves: the filesystem root /, one level up with .., and your home folder with ~.
Unlike Windows Command Prompt, Bash paths use forward slashes. cd / is the top of the tree, not a drive letter.
Jump to the root: cd /
/ is the start of every absolute path. From anywhere, cd / takes you there.
Move to a well-known location!
Go to the top of the tree:
Step up one folder: cd ..
.. always means the parent. Run it twice to climb two levels. Combine it with a name when you want a sibling folder, such as cd ../docs.
Go home: cd ~
~ expands to your home directory. cd with no argument does the same thing. Use this when you are buried in a project tree and want a fast reset.
cd ~
pwd
Typical output looks like /home/student.
Knowledge Check
1 / 3Which command takes you to the filesystem root in Bash?
References
These documentation links provide authoritative details for the commands used in this article.
Up Next
Master mkdir to create single and nested directory structures.