The cd builtin command

cd [-L|-P] [DIRECTORY]
cd -

The cd builtin command is used to change the current working directory

  • to the given directory (cd DIRECTORY)
  • to the previous working directory (cd -) as saved in the OLDPWD shell variable
  • to the user's home directory as specified in the HOME environment variable (when used without a DIRECTORY argument)

The cd builtin command searches the directories listed in CDPATH for a matching directory.

The default behaviour is to follow symbolic links unless the -P option is given or the shell is configured to do so (see the -P option of the set builtin command).

-L Follow symbolic links (default)
-P Do not follow symbolic links
-@ Browse a file's extended attributed, if supported
  • true if the directory was changed successfully
  • false if a change to the home directory was requested, but HOME is unset
  • false if anything else goes wrong


cd -

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
You could leave a comment if you were logged in.
  • commands/builtin/cd.txt
  • Last modified: 2014/10/06 04:02
  • by thebonsai