Skip to content

cd

13 commands

The shell built-in that changes the current directory, including shortcuts for home, previous and parent directories.

  • navigation
  • shell built-in

Navigation7

cd <path>

Changes the current directory to an absolute or relative path.

Link
cd

With no argument, returns to your home directory.

cd ~

Also goes home; ~ expands to $HOME.

cd ~<user>

Goes to another user's home directory, if you have permission.

Link
cd ..

Moves up one level to the parent directory.

cd ../..

Moves up two levels.

cd -

Jumps back to the previous directory and prints its path — toggles between two locations.

Tips2

cd "<path with spaces>"

Quote paths that contain spaces, or escape each space with a backslash.

Link
CDPATH=.:~/projects

Sets extra base directories that cd searches, so you can jump to frequent folders by name.

Link