c
cd(1) | cd(1) |
NAME
cd - change working directory
SYNOPSIS
cd [ directory ]
DESCRIPTION
If directory is not speci®ed, the value of shell parameter HOME is used as the new working directory. If directory speci®es a complete path starting with /, ., or .., directory becomes the new working directory. If neither case applies, cd tries to ®nd the designated directory relative to one of the paths speci®ed by the CDPATH shell variable. CDPATH has the same syntax as, and similar semantics to, the PATH shell vari- able. cd must have execute (search) permission in directory.
cd exists only as a shell
If cd is called in a subshell or a separate utility execution environment such as:
find .
(which invokes foo on accessible directories) cd does not affect the current directory of the caller's environment. Another usage of cd as a
EXTERNAL INFLUENCES
International Code Set Support
Single- and
EXAMPLES
Change the current working directory to the HOME directory from any location in the ®le system:
cd
Change to new current working directory foo residing in the current directory:
cd foo
or
cd ./foo
Change to directory foobar residing in the current directory's parent directory:
cd ../foobar
Change to the directory whose absolute pathname is /usr/local/lib/work.files:
cd /usr/local/lib/work.files
Change to the directory proj1/schedule/staffing/proposals relative to home directory:
cd $HOME/proj1/schedule/staffing/proposals
VARIABLES
The following environment variables affect the execution of cd:
HOME | The name of the home directory, used when no directory operand is speci®ed. |
CDPATH | A |
| does not begin with a slash (/) character, and the ®rst component is not dot or dot- |
| dot, cd searches for directory relative to each directory named in the CDPATH vari- |
| able, in the order listed. The new working directory is set to the ®rst matching direc- |
| tory found. An empty string in place of a directory pathname represents the current |
| directory. If CDPATH is not set, it is treated as if it was an empty string. |
RETURN VALUE |
|
Upon completion, | cd exits with one of the following values: |
Section 1−66 | − 1 − |