Name

cd

Synopsis

    cd [-LP] [dir]
    cd [-LP] [-]
    cd [-LP] [old new]

With no arguments, change to home directory of user. Otherwise, change working directory to dir. If dir is a relative pathname but is not in the current directory, the CDPATH variable is searched. A directory of - stands for the previous directory. The last syntax is specific to the Korn shell. It modifies the current directory name by replacing string old with new and then switches to the resulting directory.

Options

-L

Use the logical path (what the user typed, including any symbolic links) for cd .. and the value of PWD. This is the default.

-P

Use the actual filesystem physical path for cd .. and the value of PWD.

Example

$ pwd
    /var/spool/cron
    $ cd cron uucp   
                     Ksh: cd prints the new directory
    /var/spool/uucp

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.