How to change directory

Overview

The shell has a current working directory. Relative paths begin there; absolute paths begin at the filesystem root /.

Use pwd whenever you are unsure where you are.

Examples

pwd
cd Documents
cd /var/log
cd ..
cd ~
cd -

Path shortcuts

  • cd or cd ~ returns home
  • cd .. moves to the parent directory
  • cd - switches to the previous directory
  • . means the current directory
  • Quote a path such as cd "Course Notes"

Tips

Tab completion helps reveal the correct capitalization. If Bash reports “No such file or directory,” check spelling with ls and confirm your location with pwd.