$cd
Change the current working directory in the shell workspace.
cd [DIRECTORY]Try `cd` Live in Interactive Sandbox
Zero-install client simulation with real-time feedback.
Overview & How cd Works
`cd` (Change Directory) is a built-in shell command used to navigate across the Linux filesystem hierarchy. It updates the current working directory for all subsequent relative path operations. Using special symbols like `~` (home directory), `..` (parent directory), and `-` (previous working directory) allows lightning-fast terminal navigation.
Common Flags & Command Options
| Flag / Option | Description |
|---|---|
| ~ | Navigate directly to the current user home directory (/home/user). |
| .. | Move up one level to the parent directory. |
| - | Switch back to the previous working directory. |
| / | Navigate to the root directory of the entire filesystem. |
Practical Real-World Examples
cd /etc && pwdChanges the active directory to /etc and prints the updated path.
cd ~Quickly returns to /home/user from any location.
Frequently Asked Questions
What happens if you run cd without any arguments?
Running `cd` with no arguments automatically defaults to your home directory (`$HOME` or `/home/user`).
Related Linux Commands
List directory contents including file sizes, permissions, ownership, and modification timestamps.
Print the absolute path of the current working directory.
Create new directories and folder hierarchies.
Locate the executable binary path of a command in system PATH.
Display directory structure in a recursive visual tree diagram.