Print this page
13507 some man pages need update following 13405
6308 some man pages are obsolete after moving to ksh builtins

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/cd.1
          +++ new/usr/src/man/man1/cd.1
↓ open down ↓ 36 lines elided ↑ open up ↑
  37   37  .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38   38  .\" If applicable, add the following below this CDDL HEADER, with the
  39   39  .\" fields enclosed by brackets "[]" replaced with your own identifying
  40   40  .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41   41  .\"
  42   42  .\"
  43   43  .\" Copyright 1989 AT&T
  44   44  .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
  45   45  .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
  46   46  .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
       47 +.\" Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
  47   48  .\"
  48      -.TH CD 1 "Apr 8, 2008"
       49 +.TH CD 1 "Feb 9, 2021"
  49   50  .SH NAME
  50   51  cd, chdir, pushd, popd, dirs \- change working directory
  51   52  .SH SYNOPSIS
  52      -.LP
  53   53  .nf
  54   54  \fB/usr/bin/cd\fR [\fIdirectory\fR]
  55   55  .fi
  56   56  
  57      -.SS "sh"
  58      -.LP
  59      -.nf
  60      -\fBcd\fR [\fIargument\fR]
  61      -.fi
  62      -
  63      -.LP
  64      -.nf
  65      -\fBchdir\fR [\fIargument\fR]
  66      -.fi
  67      -
  68   57  .SS "csh"
  69      -.LP
  70   58  .nf
  71   59  \fBcd\fR [\fIdir\fR]
  72   60  .fi
  73   61  
  74   62  .LP
  75   63  .nf
  76   64  \fBchdir\fR [\fIdir\fR]
  77   65  .fi
  78   66  
  79   67  .LP
↓ open down ↓ 4 lines elided ↑ open up ↑
  84   72  .LP
  85   73  .nf
  86   74  \fBpopd\fR [\fB+\fR\fIn\fR]
  87   75  .fi
  88   76  
  89   77  .LP
  90   78  .nf
  91   79  \fBdirs\fR [\fB-l\fR]
  92   80  .fi
  93   81  
  94      -.SS "ksh, ksh93"
  95      -.LP
       82 +.SS "ksh93"
  96   83  .nf
  97   84  \fBcd\fR [\fB-L\fR] [\fB-P\fR] [\fIarg\fR]
  98   85  .fi
  99   86  
 100   87  .LP
 101   88  .nf
 102   89  \fBcd\fR \fIold\fR \fInew\fR
 103   90  .fi
 104   91  
 105   92  .SH DESCRIPTION
 106   93  .SS "/usr/bin/cd"
 107      -.sp
 108      -.LP
 109   94  The \fB/usr/bin/cd\fR utility changes the current directory in the context of
 110   95  the \fBcd\fR utility only. This is in contrast to the version built into the
 111   96  shell. \fB/usr/bin/cd\fR has no effect on the invoking process but can be used
 112   97  to determine whether or not a given directory can be set as the current
 113   98  directory.
 114      -.SS "sh"
 115      -.sp
 116      -.LP
 117      -The Bourne shell built-in \fBcd\fR changes the current directory to
 118      -\fIargument\fR. The shell parameter \fBHOME\fR is the default \fIargument\fR.
 119      -The shell parameter \fBCDPATH\fR defines the search path for the directory
 120      -containing \fIargument\fR. Alternative directory names are separated by a colon
 121      -(\fB:\fR). The default path is \fB<null>\fR (specifying the current directory).
 122      -The current directory is specified by a null path name, which can appear
 123      -immediately after the equal sign or between the colon delimiters anywhere else
 124      -in the path list. If \fIargument\fR begins with `\fB/\fR', `\fB\&.\fR', or
 125      -`\fB\&.\|.\fR', the search path is not used. Otherwise, each directory in the
 126      -path is searched for \fIargument\fR. \fBcd\fR must have execute (search)
 127      -permission in \fIargument\fR. Because a new process is created to execute each
 128      -command, \fBcd\fR would be ineffective if it were written as a normal command;
 129      -therefore, it is recognized by and is internal to the shell. (See \fBpwd\fR(1),
 130      -\fBsh\fR(1), and \fBchdir\fR(2)).
 131      -.sp
 132      -.LP
 133      -\fBchdir\fR is just another way to call \fBcd\fR.
 134   99  .SS "csh"
 135      -.sp
 136      -.LP
 137  100  If \fIdir\fR is not specified, the C shell built-in \fBcd\fR uses the value of
 138  101  shell parameter \fBHOME\fR as the new working directory. If \fIdir\fR specifies
 139  102  a complete path starting with `\fB/\fR', `\fB\&.\fR', or `\fB\&.\|.\fR',
 140  103  \fIdir\fR becomes the new working directory. If neither case applies, \fBcd\fR
 141  104  tries to find the designated directory relative to one of the paths specified
 142  105  by the \fBCDPATH\fR shell variable. \fBCDPATH\fR has the same syntax as, and
 143  106  similar semantics to, the \fBPATH\fR shell variable. \fBcd\fR must have execute
 144  107  (search) permission in \fIdir\fR. Because a new process is created to execute
 145  108  each command, \fBcd\fR would be ineffective if it were written as a normal
 146  109  command; therefore, it is recognized by and is internal to the C-shell. (See
↓ open down ↓ 6 lines elided ↑ open up ↑
 153  116  directories listed in the \fBcdpath\fR variable. If \fIdir\fR is the name of a
 154  117  shell variable whose value starts with a \fB/\fR, change to the directory named
 155  118  by that value.
 156  119  .sp
 157  120  .LP
 158  121  \fBpushd\fR pushes a directory onto the directory stack. With no arguments,
 159  122  exchange the top two elements.
 160  123  .sp
 161  124  .ne 2
 162  125  .na
 163      -\fB\fB+\fR\fIn\fR\fR
      126 +\fB+\fR\fIn\fR
 164  127  .ad
 165  128  .RS 7n
 166  129  Rotate the \fIn\fR'th entry to the top of the stack and \fBcd\fR to it.
 167  130  .RE
 168  131  
 169  132  .sp
 170  133  .ne 2
 171  134  .na
 172      -\fB\fIdir\fR\fR
      135 +\fB\fIdir\fR
 173  136  .ad
 174  137  .RS 7n
 175  138  Push the current working directory onto the stack and change to \fIdir\fR.
 176  139  .RE
 177  140  
 178  141  .sp
 179  142  .LP
 180  143  \fBpopd\fR pops the directory stack and \fBcd\fR to the new top directory. The
 181  144  elements of the directory stack are numbered from 0 starting at the top.
 182  145  .sp
 183  146  .ne 2
 184  147  .na
 185      -\fB\fB+\fR\fIn\fR\fR
      148 +\fB+\fR\fIn\fR
 186  149  .ad
 187  150  .RS 6n
 188  151  Discard the \fIn\fR'th entry in the stack.
 189  152  .RE
 190  153  
 191  154  .sp
 192  155  .LP
 193  156  \fBdirs\fR prints the directory stack, most recent to the left; the first
 194  157  directory shown is the current directory. With the \fB-l\fR argument, produce
 195  158  an unabbreviated printout; use of the \fB~\fR notation is suppressed.
 196      -.SS "ksh, ksh93"
 197      -.sp
 198      -.LP
      159 +.SS "ksh93"
 199  160  The Korn shell built-in \fBcd\fR command can be in either of two forms. In the
 200  161  first form it changes the current directory to \fIarg\fR. If \fIarg\fR is
 201  162  \fB\(mi\fR the directory is changed to the previous directory. The shell
 202  163  variable \fBHOME\fR is the default \fIarg\fR. The environment variable
 203  164  \fBPWD\fR is set to the current directory. If the \fBPWD\fR is changed, the
 204  165  \fBOLDPWD\fR environment variable shall also be changed to the value of the old
 205  166  working directory, that is, the current working directory immediately prior to
 206  167  the call to change directory (\fBcd\fR). The shell variable \fBCDPATH\fR
 207  168  defines the search path for the directory containing \fIarg\fR. Alternative
 208  169  directory names are separated by a colon (\fB:\fR). The default path is
↓ open down ↓ 1 lines elided ↑ open up ↑
 210  171  specified by a null path name, which can appear immediately after the equal
 211  172  sign or between the colon delimiters anywhere else in the path list. If
 212  173  \fIarg\fR begins with a `\fB/\fR', `\fB\&.\fR', or `\fB\&.\|.\fR', then the
 213  174  search path is not used. Otherwise, each directory in the path is searched for
 214  175  \fIarg\fR. If unsuccessful, \fBcd\fR attempts to change directories to the
 215  176  pathname formed by the concatenation of the value of PWD, a slash character,
 216  177  and arg.
 217  178  .sp
 218  179  .ne 2
 219  180  .na
 220      -\fB\fB-L\fR\fR
      181 +\fB-L\fR
 221  182  .ad
 222  183  .RS 6n
 223  184  Handles the operation dot-dot (\fB\&..\fR) logically. Symbolic link components
 224  185  are \fBnot\fR resolved before dot-dot components are processed.
 225  186  .RE
 226  187  
 227  188  .sp
 228  189  .ne 2
 229  190  .na
 230      -\fB\fB-P\fR\fR
      191 +\fB-P\fR
 231  192  .ad
 232  193  .RS 6n
 233  194  Handles the operand dot-dot physically. Symbolic link components \fBare\fR
 234  195  resolved before dot-dot components are processed.
 235  196  .RE
 236  197  
 237  198  .sp
 238  199  .LP
 239  200  If both \fB-L\fR and \fB-P\fR options are specified, the last option to be
 240  201  invoked is used and the other is ignored. If neither \fB-L\fR nor \fB-P\fR is
↓ open down ↓ 1 lines elided ↑ open up ↑
 242  203  .sp
 243  204  .LP
 244  205  The second form of \fBcd\fR substitutes the string \fInew\fR for the string
 245  206  \fIold\fR in the current directory name, \fBPWD\fR and tries to change to this
 246  207  new directory.
 247  208  .sp
 248  209  .LP
 249  210  The \fBcd\fR command cannot be executed by \fBrksh\fR. Because a new process is
 250  211  created to execute each command, \fBcd\fR would be ineffective if it were
 251  212  written as a normal command; therefore, it is recognized by and is internal to
 252      -the Korn shell. (See \fBpwd\fR(1), \fBsh\fR(1), and \fBchdir\fR(2)).
      213 +the Korn shell. (See \fBpwd\fR(1), \fBksh93\fR(1), and \fBchdir\fR(2)).
 253  214  .SH OPERANDS
 254      -.sp
 255      -.LP
 256  215  The following operands are supported:
 257  216  .sp
 258  217  .ne 2
 259  218  .na
 260      -\fB\fIdirectory\fR\fR
      219 +\fB\fIdirectory\fR
 261  220  .ad
 262  221  .RS 13n
 263  222  An absolute or relative pathname of the directory that becomes the new working
 264  223  directory. The interpretation of a relative pathname by \fBcd\fR depends on the
 265  224  \fBCDPATH\fR environment variable.
 266  225  .RE
 267  226  
 268  227  .SH OUTPUT
 269      -.sp
 270      -.LP
 271  228  If a non-empty directory name from \fBCDPATH\fR is used, an absolute pathname
 272  229  of the new working directory is written to the standard output as follows:
 273  230  .sp
 274  231  .LP
 275  232  \fB"%s\en"\fR, <\fInew directory\fR>
 276  233  .sp
 277  234  .LP
 278  235  Otherwise, there is no output.
 279  236  .SH ENVIRONMENT VARIABLES
 280      -.sp
 281      -.LP
 282  237  See \fBenviron\fR(5) for descriptions of the following environment variables
 283  238  that affect the execution of \fBcd\fR: \fBLANG\fR, \fBLC_ALL\fR,
 284  239  \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 285  240  .sp
 286  241  .ne 2
 287  242  .na
 288      -\fB\fBCDPATH\fR\fR
      243 +\fBCDPATH\fR
 289  244  .ad
 290  245  .RS 10n
 291  246  A colon-separated list of pathnames that refer to directories. If the
 292  247  \fIdirectory\fR operand does not begin with a slash \fB(\fR \fB/\fR \fB)\fR
 293  248  character, and the first component is not dot or dot-dot, \fBcd\fR searches for
 294  249  \fIdirectory\fR relative to each directory named in the \fBCDPATH\fR variable,
 295  250  in the order listed. The new working directory sets to the first matching
 296  251  directory found. An empty string in place of a directory pathname represents
 297  252  the current directory. If \fBCDPATH\fR is not set, it is treated as if it were
 298  253  an empty string.
 299  254  .RE
 300  255  
 301  256  .sp
 302  257  .ne 2
 303  258  .na
 304      -\fB\fBHOME\fR\fR
      259 +\fBHOME\fR
 305  260  .ad
 306  261  .RS 10n
 307  262  The name of the home directory, used when no \fIdirectory\fR operand is
 308  263  specified.
 309  264  .RE
 310  265  
 311  266  .sp
 312  267  .ne 2
 313  268  .na
 314      -\fB\fBOLDPWD\fR\fR
      269 +\fBOLDPWD\fR
 315  270  .ad
 316  271  .RS 10n
 317  272  A pathname of the previous working directory, used by \fBcd-\fR.
 318  273  .RE
 319  274  
 320  275  .sp
 321  276  .ne 2
 322  277  .na
 323      -\fB\fBPWD\fR\fR
      278 +\fBPWD\fR
 324  279  .ad
 325  280  .RS 10n
 326  281  A pathname of the current working directory, set by \fBcd\fR after it has
 327  282  changed to that directory.
 328  283  .RE
 329  284  
 330  285  .SH EXIT STATUS
 331      -.sp
 332      -.LP
 333  286  The following exit values are returned by \fBcd\fR:
 334  287  .sp
 335  288  .ne 2
 336  289  .na
 337      -\fB\fB0\fR\fR
      290 +\fB0\fR
 338  291  .ad
 339  292  .RS 6n
 340  293  The directory was successfully changed.
 341  294  .RE
 342  295  
 343  296  .sp
 344  297  .ne 2
 345  298  .na
 346      -\fB\fB>0\fR\fR
      299 +\fB>0\fR
 347  300  .ad
 348  301  .RS 6n
 349  302  An error occurred.
 350  303  .RE
 351  304  
 352  305  .SH ATTRIBUTES
 353      -.sp
 354      -.LP
 355  306  See \fBattributes\fR(5) for descriptions of the following attributes:
 356      -.SS "csh, ksh, sh"
 357      -.sp
 358      -
 359      -.sp
      307 +.SS "csh"
 360  308  .TS
 361  309  box;
 362  310  c | c
 363  311  l | l .
 364  312  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 365  313  _
 366  314  Interface Stability     Committed
 367  315  _
 368  316  Standard        See \fBstandards\fR(5).
 369  317  .TE
 370  318  
 371  319  .SS "ksh93"
 372      -.sp
 373      -
 374      -.sp
 375  320  .TS
 376  321  box;
 377  322  c | c
 378  323  l | l .
 379  324  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 380  325  _
 381  326  Interface Stability     Uncommitted
 382  327  .TE
 383  328  
 384  329  .SH SEE ALSO
 385      -.sp
 386      -.LP
 387      -\fBcsh\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBpwd\fR(1), \fBsh\fR(1),
      330 +\fBcsh\fR(1), \fBksh93\fR(1), \fBpwd\fR(1),
 388  331  \fBchdir\fR(2), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX