Home Explore Blog CI



man-pages

cd.txt
cbbbb118f64c77893570c4787ff8241f686b5cf10f6b75cd000000030000064b
cd: cd [-L|[-P [-e]] [-@]] [dir]
    Change the shell working directory.
    
    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable. If DIR is "-", it is converted to $OLDPWD.
    
    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.
    
    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.
    
    Options:
      -L	force symbolic links to be followed: resolve symbolic
    		links in DIR after processing instances of `..'
      -P	use the physical directory structure without following
    		symbolic links: resolve symbolic links in DIR before
    		processing instances of `..'
      -e	if the -P option is supplied, and the current working
    		directory cannot be determined successfully, exit with
    		a non-zero status
      -@	on systems that support it, present a file with extended
    		attributes as a directory containing the file attributes
    
    The default is to follow symbolic links, as if `-L' were specified.
    `..' is processed by removing the immediately previous pathname component
    back to a slash or the beginning of DIR.
    
    Exit Status:
    Returns 0 if the directory is changed, and if $PWD is set successfully when
    -P is used; non-zero otherwise.

Chunks
8c9a1d1c (1st chunk of `cd.txt`)
Title: cd Command: Changing the Working Directory
Summary
This text describes the `cd` command, which changes the shell's working directory. It explains how to use the command with options like `-L` (follow symbolic links), `-P` (use physical directory structure), `-e` (exit if the current working directory cannot be determined successfully), and `-@` (present a file with extended attributes as a directory). It also covers how CDPATH is used, how the command handles variables, and the exit status of the command.