Print this page
13507 some man pages need update following 13405
6308 some man pages are obsolete after moving to ksh builtins
   1 CD(1)                            User Commands                           CD(1)
   2 
   3 
   4 
   5 NAME
   6        cd, chdir, pushd, popd, dirs - change working directory
   7 
   8 SYNOPSIS
   9        /usr/bin/cd [directory]
  10 
  11 
  12    sh
  13        cd [argument]
  14 
  15 
  16        chdir [argument]
  17 
  18 
  19    csh
  20        cd [dir]
  21 
  22 
  23        chdir [dir]
  24 
  25 
  26        pushd [+n | dir]
  27 
  28 
  29        popd [+n]
  30 
  31 
  32        dirs [-l]
  33 
  34 
  35    ksh, ksh93
  36        cd [-L] [-P] [arg]
  37 
  38 
  39        cd old new
  40 
  41 
  42 DESCRIPTION
  43    /usr/bin/cd
  44        The /usr/bin/cd utility changes the current directory in the context of
  45        the cd utility only. This is in contrast to the version built into the
  46        shell. /usr/bin/cd has no effect on the invoking process but can be
  47        used to determine whether or not a given directory can be set as the
  48        current directory.
  49 
  50    sh
  51        The Bourne shell built-in cd changes the current directory to argument.
  52        The shell parameter HOME is the default argument.  The shell parameter
  53        CDPATH defines the search path for the directory containing argument.
  54        Alternative directory names are separated by a colon (:). The default
  55        path is <null> (specifying the current directory).  The current
  56        directory is specified by a null path name, which can appear
  57        immediately after the equal sign or between the colon delimiters
  58        anywhere else in the path list. If argument begins with `/', `.', or
  59        `..', the search path is not used. Otherwise, each directory in the
  60        path is searched for argument. cd must have execute (search) permission
  61        in argument. Because a new process is created to execute each command,
  62        cd would be ineffective if it were written as a normal command;
  63        therefore, it is recognized by and is internal to the shell. (See
  64        pwd(1), sh(1), and chdir(2)).
  65 
  66 
  67        chdir is just another way to call cd.
  68 
  69    csh
  70        If dir is not specified, the C shell built-in cd uses the value of
  71        shell parameter HOME as the new working directory. If dir specifies a
  72        complete path starting with `/', `.', or `..', dir becomes the new
  73        working directory. If neither case applies, cd tries to find the
  74        designated directory relative to one of the paths specified by the
  75        CDPATH shell variable. CDPATH has the same syntax as, and similar
  76        semantics to, the PATH shell variable. cd must have execute (search)
  77        permission in dir. Because a new process is created to execute each
  78        command, cd would be ineffective if it were written as a normal
  79        command; therefore, it is recognized by and is internal to the C-shell.
  80        (See pwd(1), sh(1), and chdir(2)).
  81 
  82 
  83        chdir changes the shell's working directory to directory dir. If no
  84        argument is given, change to the home directory of the user. If dir is
  85        a relative pathname not found in the current directory, check for it in
  86        those directories listed in the cdpath variable. If dir is the name of
  87        a shell variable whose value starts with a /, change to the directory
  88        named by that value.


  97 
  98        dir
  99               Push the current working directory onto the stack and change to
 100               dir.
 101 
 102 
 103 
 104        popd pops the directory stack and cd to the new top directory. The
 105        elements of the directory stack are numbered from 0 starting at the
 106        top.
 107 
 108        +n
 109              Discard the n'th entry in the stack.
 110 
 111 
 112 
 113        dirs prints the directory stack, most recent to the left; the first
 114        directory shown is the current directory. With the -l argument, produce
 115        an unabbreviated printout; use of the ~ notation is suppressed.
 116 
 117    ksh, ksh93
 118        The Korn shell built-in cd command can be in either of two forms. In
 119        the first form it changes the current directory to arg. If arg is - the
 120        directory is changed to the previous directory. The shell variable HOME
 121        is the default arg. The environment variable PWD is set to the current
 122        directory. If the PWD is changed, the OLDPWD environment variable shall
 123        also be changed to the value of the old working directory, that is, the
 124        current working directory immediately prior to the call to change
 125        directory (cd). The shell variable CDPATH defines the search path for
 126        the directory containing arg. Alternative directory names are separated
 127        by a colon (:). The default path is null (specifying the current
 128        directory). The current directory is specified by a null path name,
 129        which can appear immediately after the equal sign or between the colon
 130        delimiters anywhere else in the path list. If arg begins with a `/',
 131        `.', or `..', then the search path is not used. Otherwise, each
 132        directory in the path is searched for arg. If unsuccessful, cd attempts
 133        to change directories to the pathname formed by the concatenation of
 134        the value of PWD, a slash character, and arg.
 135 
 136        -L
 137              Handles the operation dot-dot (..) logically. Symbolic link


 141 
 142        -P
 143              Handles the operand dot-dot physically. Symbolic link components
 144              are resolved before dot-dot components are processed.
 145 
 146 
 147 
 148        If both -L and -P options are specified, the last option to be invoked
 149        is used and the other is ignored. If neither -L nor -P is specified,
 150        the operand is handled dot-dot logically.
 151 
 152 
 153        The second form of cd substitutes the string new for the string old in
 154        the current directory name, PWD and tries to change to this new
 155        directory.
 156 
 157 
 158        The cd command cannot be executed by rksh. Because a new process is
 159        created to execute each command, cd would be ineffective if it were
 160        written as a normal command; therefore, it is recognized by and is
 161        internal to the Korn shell. (See pwd(1), sh(1), and chdir(2)).
 162 
 163 OPERANDS
 164        The following operands are supported:
 165 
 166        directory
 167                     An absolute or relative pathname of the directory that
 168                     becomes the new working directory. The interpretation of a
 169                     relative pathname by cd depends on the CDPATH environment
 170                     variable.
 171 
 172 
 173 OUTPUT
 174        If a non-empty directory name from CDPATH is used, an absolute pathname
 175        of the new working directory is written to the standard output as
 176        follows:
 177 
 178 
 179        "%s\n", <new directory>
 180 
 181 


 209 
 210        PWD
 211                  A pathname of the current working directory, set by cd after
 212                  it has changed to that directory.
 213 
 214 
 215 EXIT STATUS
 216        The following exit values are returned by cd:
 217 
 218        0
 219              The directory was successfully changed.
 220 
 221 
 222        >0
 223              An error occurred.
 224 
 225 
 226 ATTRIBUTES
 227        See attributes(5) for descriptions of the following attributes:
 228 
 229    csh, ksh, sh
 230 
 231 
 232 
 233        +--------------------+-------------------+
 234        |  ATTRIBUTE TYPE    |  ATTRIBUTE VALUE  |
 235        +--------------------+-------------------+
 236        |Interface Stability | Committed         |
 237        +--------------------+-------------------+
 238        |Standard            | See standards(5). |
 239        +--------------------+-------------------+
 240 
 241    ksh93
 242 
 243 
 244 
 245        +--------------------+-----------------+
 246        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 247        +--------------------+-----------------+
 248        |Interface Stability | Uncommitted     |
 249        +--------------------+-----------------+
 250 
 251 SEE ALSO
 252        csh(1), ksh(1), ksh93(1), pwd(1), sh(1), chdir(2), attributes(5),
 253        environ(5), standards(5)
 254 
 255 
 256 
 257                                  April 8, 2008                           CD(1)
   1 CD(1)                            User Commands                           CD(1)
   2 
   3 
   4 
   5 NAME
   6        cd, chdir, pushd, popd, dirs - change working directory
   7 
   8 SYNOPSIS
   9        /usr/bin/cd [directory]
  10 
  11 







  12    csh
  13        cd [dir]
  14 
  15 
  16        chdir [dir]
  17 
  18 
  19        pushd [+n | dir]
  20 
  21 
  22        popd [+n]
  23 
  24 
  25        dirs [-l]
  26 
  27 
  28    ksh93
  29        cd [-L] [-P] [arg]
  30 
  31 
  32        cd old new
  33 
  34 
  35 DESCRIPTION
  36    /usr/bin/cd
  37        The /usr/bin/cd utility changes the current directory in the context of
  38        the cd utility only. This is in contrast to the version built into the
  39        shell. /usr/bin/cd has no effect on the invoking process but can be
  40        used to determine whether or not a given directory can be set as the
  41        current directory.
  42 



















  43    csh
  44        If dir is not specified, the C shell built-in cd uses the value of
  45        shell parameter HOME as the new working directory. If dir specifies a
  46        complete path starting with `/', `.', or `..', dir becomes the new
  47        working directory. If neither case applies, cd tries to find the
  48        designated directory relative to one of the paths specified by the
  49        CDPATH shell variable. CDPATH has the same syntax as, and similar
  50        semantics to, the PATH shell variable. cd must have execute (search)
  51        permission in dir. Because a new process is created to execute each
  52        command, cd would be ineffective if it were written as a normal
  53        command; therefore, it is recognized by and is internal to the C-shell.
  54        (See pwd(1), sh(1), and chdir(2)).
  55 
  56 
  57        chdir changes the shell's working directory to directory dir. If no
  58        argument is given, change to the home directory of the user. If dir is
  59        a relative pathname not found in the current directory, check for it in
  60        those directories listed in the cdpath variable. If dir is the name of
  61        a shell variable whose value starts with a /, change to the directory
  62        named by that value.


  71 
  72        dir
  73               Push the current working directory onto the stack and change to
  74               dir.
  75 
  76 
  77 
  78        popd pops the directory stack and cd to the new top directory. The
  79        elements of the directory stack are numbered from 0 starting at the
  80        top.
  81 
  82        +n
  83              Discard the n'th entry in the stack.
  84 
  85 
  86 
  87        dirs prints the directory stack, most recent to the left; the first
  88        directory shown is the current directory. With the -l argument, produce
  89        an unabbreviated printout; use of the ~ notation is suppressed.
  90 
  91    ksh93
  92        The Korn shell built-in cd command can be in either of two forms. In
  93        the first form it changes the current directory to arg. If arg is - the
  94        directory is changed to the previous directory. The shell variable HOME
  95        is the default arg. The environment variable PWD is set to the current
  96        directory. If the PWD is changed, the OLDPWD environment variable shall
  97        also be changed to the value of the old working directory, that is, the
  98        current working directory immediately prior to the call to change
  99        directory (cd). The shell variable CDPATH defines the search path for
 100        the directory containing arg. Alternative directory names are separated
 101        by a colon (:). The default path is null (specifying the current
 102        directory). The current directory is specified by a null path name,
 103        which can appear immediately after the equal sign or between the colon
 104        delimiters anywhere else in the path list. If arg begins with a `/',
 105        `.', or `..', then the search path is not used. Otherwise, each
 106        directory in the path is searched for arg. If unsuccessful, cd attempts
 107        to change directories to the pathname formed by the concatenation of
 108        the value of PWD, a slash character, and arg.
 109 
 110        -L
 111              Handles the operation dot-dot (..) logically. Symbolic link


 115 
 116        -P
 117              Handles the operand dot-dot physically. Symbolic link components
 118              are resolved before dot-dot components are processed.
 119 
 120 
 121 
 122        If both -L and -P options are specified, the last option to be invoked
 123        is used and the other is ignored. If neither -L nor -P is specified,
 124        the operand is handled dot-dot logically.
 125 
 126 
 127        The second form of cd substitutes the string new for the string old in
 128        the current directory name, PWD and tries to change to this new
 129        directory.
 130 
 131 
 132        The cd command cannot be executed by rksh. Because a new process is
 133        created to execute each command, cd would be ineffective if it were
 134        written as a normal command; therefore, it is recognized by and is
 135        internal to the Korn shell. (See pwd(1), ksh93(1), and chdir(2)).
 136 
 137 OPERANDS
 138        The following operands are supported:
 139 
 140        directory
 141                     An absolute or relative pathname of the directory that
 142                     becomes the new working directory. The interpretation of a
 143                     relative pathname by cd depends on the CDPATH environment
 144                     variable.
 145 
 146 
 147 OUTPUT
 148        If a non-empty directory name from CDPATH is used, an absolute pathname
 149        of the new working directory is written to the standard output as
 150        follows:
 151 
 152 
 153        "%s\n", <new directory>
 154 
 155 


 183 
 184        PWD
 185                  A pathname of the current working directory, set by cd after
 186                  it has changed to that directory.
 187 
 188 
 189 EXIT STATUS
 190        The following exit values are returned by cd:
 191 
 192        0
 193              The directory was successfully changed.
 194 
 195 
 196        >0
 197              An error occurred.
 198 
 199 
 200 ATTRIBUTES
 201        See attributes(5) for descriptions of the following attributes:
 202 
 203    csh
 204 


 205        +--------------------+-------------------+
 206        |  ATTRIBUTE TYPE    |  ATTRIBUTE VALUE  |
 207        +--------------------+-------------------+
 208        |Interface Stability | Committed         |
 209        +--------------------+-------------------+
 210        |Standard            | See standards(5). |
 211        +--------------------+-------------------+
 212 
 213    ksh93
 214 


 215        +--------------------+-----------------+
 216        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 217        +--------------------+-----------------+
 218        |Interface Stability | Uncommitted     |
 219        +--------------------+-----------------+
 220 
 221 SEE ALSO
 222        csh(1), ksh93(1), pwd(1), chdir(2), attributes(5), environ(5),
 223        standards(5)
 224 
 225 
 226 
 227                                February 9, 2021                          CD(1)