Table of Contents

The cd builtin command

Synopsis

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

Description

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

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).

Options

OptionDescription
-L Follow symbolic links (default)
-P Do not follow symbolic links
-@ Browse a file's extended attributed, if supported

Exit status

Examples

Change the working directory to the user's home directory

cd

Change the working directory to the previous directory

cd -

Portability considerations

See also