Online Linux Terminal Logo
OnlineLinuxTerminal
NavigationCLI Reference

$cd

Change the current working directory in the shell workspace.

Syntax DefinitionPOSIX standard
cd [DIRECTORY]
Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Try `cd` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

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 / OptionDescription
~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

Example #1Navigate to the /etc configuration folder
cd /etc && pwd

Changes the active directory to /etc and prints the updated path.

Sample Output:
/etc
Example #2Return to user home directory

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`).