cd - change directory


cd [directory]
cd -
chdir [directory]
chdir -


The cd command is a built-in command in the C Shell and the Korn Shell. The chdir command is a built-in command in the C shell and is a synonym for cd.

The cd(1) command sets the current working directory to directory.

If no directory is specified, cd(1) changes to the HOME directory. When the shell successfully changes directories, it stores the name of the old directory in a variable (OLDPWD for ksh(1), owd in tcsh(1)). The command:

cd -
changes back to the previous directory.

If the specified directory does not begin with a slash (/) and is not a subdirectory of the current directory, the shell searches through a list of directories for the specified directory. In the Korn shell (ksh(1)), the list of directories is stored in the variable CDPATH; if the variable is unset or is null, only the current directory is searched. (In the C shell, see the cdpath variable.)

The cd(1) command supports additional options, depending on the shell. For more information, see ksh(1) and tcsh(1).