Skip to content

The cd command

Change the current directory. Moves you into another directory. With no argument it takes you home (~). "cd .." goes up one level, and "cd -" goes back to the directory you were in before. cd is built into the shell, so it has no options worth knowing here.

Usage

cd [DIRECTORY]

Examples

  • cd projectsInto the projects folder inside the current one
  • cd ..Up one level
  • cd /etcTo an absolute path, from anywhere
  • cdHome
  • cd -Back to the previous directory

Learn it step by step

learner@sandbox: ~bash (practice)
Note: Try cd here: your home directory has sample files. Press Try beside an example, or type your own.

A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.