Skip to content

cd command

Change the current working directory.

On this page

Syntax

cd [directory]

Provided by the shell builtin package. Run man cd for the full manual.

Common options

OptionWhat it does
~Your home directory (also plain cd)
-The previous directory
..The parent directory
-PResolve symbolic links to the physical path

Examples

  1. Go to your home directory

    cd
  2. Go to the parent directory

    cd ..
  3. Go back to the previous directory

    cd -
  4. Go to an absolute path

    cd /var/www/html
  5. Go two levels up

    cd ../..
  6. Path with spaces

    cd "My Documents"

Tips

  • Run pwd to print where you are.

cd guides

← All Linux commands · Suggest a fix

Back to top