Hamilton LaboratoriesHamilton C shell 2012User guideBuiltin utilities


Oregon Coast

Previous | Next

        Change to a New Current Directory

Usage:  cd [-chr-] [+chr ] directory

   cd works exactly like the one in cmd.exe by default:  if you
   specify a directory, it tries to make that the current on the
   appropriate disk but won't change your current disk.  If you don't
   specify a directory, it reports the current setting.

   If the path you specify is just 3 or more dots, cd will interpret
   that specially.  Just as ".." means go up one level, "..." means
   up 2 levels, "...." means up 3 levels, etc.  Note that "..." is
   also a wildcard notation for zero or more directory levels, but
   only if it's preceded by "\", "/", "~" or ":" or followed by
   "\" or "/", so usually there's no conflict with this notation
   for going up multiple directories with cd.  The exception is when
   you'd like to go up multiple directories on an explicitly specified
   drive; in that case, you'll have to quote the word to turn off the

   This version of cd also supports CDPATH.  If you specify a path
   that isn't found, cd will look through the list of any directories
   you specify in the CDPATH environmental variable (or the equivalent
   cdpath shell variable) to see if the directory you want is in one
   of those directories.   The syntax for CDPATH and cdpath is the
   same as for PATH or path except that the current directory need
   not be listed.

   (See also the dirs, pushd, popd and rotd commands.)


   If you set the chgdisk variable equal to 1 (its default is 0), cd
   will automatically change current disks if the directory is on
   another drive.  The +c and -c options allow you to manually control
   this drive switching:

   +c   Automatically change the current disk
   -c   Don't automatically change current disk

   If you set the cdhome variable to 1 (its default is 0), cd will
   change to your home directory if you don't specify one instead of
   reporting your current position.  You can manually control this with
   the +r and -r options:

   +r   Report but don't change the current directory if no
        destination directory is specified.
   -r   Change to the home directory in this situation.

   -h   Help.  (This screen.)
   --   End of options.

(The slash, "/", may be used instead of a minus to introduce
options.  To specify a different set of characters to introduce
options, use the SWITCHCHARS environmental variable.)

Previous | Next