•Arnošt Havelka
Directory Navigation in Bash
Master the cd command to move around your file system.
Start Interactive LessonDirectory Navigation in Bash
Now that you know where you are and what's around you, it's time to move. The cd command is your passport to navigate through directories.
Moving Between Directories
The cd command (change directory) is how you explore your file system. You can jump to any directory with a single command.
Usage:cd[directory]
cd
Change Directory - moves you to a different location in the file system.
Real-World Examples
Navigate to a specific directory:
Command Prompt
/home/user
C:\Users\User>pwd
Going Back: Parent Directory
Need to go back? Use cd .. to move up one level to the parent directory.
Usage:cd..
..
Parent Directory - takes you one level up in the directory tree.
Climb back up:
Command Prompt
/home/user/Documents
C:\Users\User>pwd
Quick Navigation to /tmp
The /tmp directory is perfect for temporary files. Jump there instantly with cd /tmp.
Command Prompt
/home/user
C:\Users\User>pwd
Understanding Paths
- Absolute path (starts with
/):/tmp,/home/user- goes from the root - Relative path (no
/at start):Documents,..- relative to where you are now
Knowledge Check
1 / 3What does cd stand for?
References
These Microsoft Learn and Windows documentation links provide authoritative details for the commands used in this article.