Skip to main content
LESSON 3 of 5//Core Navigation

Navigating with cd

The cd (change directory) command is how you move around the filesystem. Think of directories as folders — cd lets you step into and out of them.

Basic navigationzsh // interactive
# Move into a directory
~cd Documents
# Move up one level (parent directory)
~cd ..
# Go directly to home directory
~cd ~
# Go to the previous directory you were in
~cd -
/Users/developer/Documents

Special directories

. refers to the current directory, .. refers to the parent directory, ~ refers to your home directory, and / is the root of the entire filesystem.

Navigating with pathszsh // interactive
# Navigate multiple levels at once
~cd ~/projects/my-app/src
# Go up two levels
~cd ../..
# Use absolute path (starts with /)
~cd /usr/local/bin

Tab completion

Press Tab while typing a directory name to auto-complete it. Press Tab twice to see all options if there are multiple matches. This saves enormous amounts of typing.

PRACTICE//Try the commands from this lesson
INTERACTIVE_TERMINAL//sandbox
Practice terminal — try the commands from this lesson!
Type 'help' for available commands. Tab completion not available in simulator.
Try: