Home OS X
OS X Syntax

cd

Change Directory - change the current working Folder.

SYNTAX 
      cd [-p] [-l] [-n|-v] [folder]
      cd -

OPTIONS
    -p         Print the final directory stack, just like dirs.

    -l, `~' or `~name' in the output is expanded explicitly to home or the pathname
               of the home directory for user name.
	          
    -n         Entries are wrapped before they reach the edge of the screen.

    -v         entries are printed one per line, preceded by their stack positions.
	       
If more than one of -n or -v is given, -v takes precedence.
The -l, -n and -v flags imply -p.  (+)

Notes
If a folder is given, changes the shell's working directory to name. If not, changes to home.

`cd -' will go back to the last folder you looked at. (Previous directory)

If folder is not a subfolder of the current folder (and does not begin with `/', `./' or `../'), each component of the variable cdpath is checked to see if it has a subdirectory folder. Finally, if all else fails but folder is a shell variable whose value begins with `/', then this is tried to see if it is a folder.

See also the implicitcd shell variable.

The return status is zero if the directory is successfully changed, non-zero otherwise.

Examples

Move to a subfolder named "Documents"
 $ cd Documents

move to the sybase folder
 $ cd  /usr/local/sybase
 $ pwd
 /usr/local/sybase

Change to another folder
 $ cd /var/log
 $ pwd
 /var/log

Move up to the parent of the current directory (/var)
 cd ..

To move up two levels:
 $ cd ../..

Move to the top of the boot volume
 $ cd /

Move to the boot volume, top-level folder named "Users"
 $ cd /Users

Move to your home directory
 $ cd ~

Move to the top-level folder named "Applications (MacOS 9)"
 $ cd '/Applications (MacOS 9)'

The quotes are required when the folder name includes spaces, parentheses
or any other punctuation that might confuse it.

`cd' is a tcsh shell command.

"In times of change, learners inherit the earth, while the learned find themselves equipped to deal with a world that no longer exists." - Eric Hoffer

Related commands:

pwd - Print Working Directory

Equivalent BASH command:

cd - Change Directory



Back to the Top

Simon Sheppard
SS64.com