From Mac Guides

Jump to: navigation, search

This guide provides information about a Terminal command. You may be looking for information on Compact Discs.

cd is a command used to set the current directory. The current directory is the directory which file paths you enter are relative to. For example, if the current directory was "~/Library/" and you entered as a parameter to a command "Preferences", it would treat it as if you had typed "~/Library/Preferences". Commands that have an optional file path parameter, such as ls, will often use the current directory if none is specified.

The current directory is displayed in the command prompt, as follows

[Computer-Name:Current-Directory] username% 

Where Computer-Name is the name of your computer and username is your current username.


Reset the current directory to your home folder (the default)


Set the current directory to the Applications folder

 cd /Applications

Man Page Excerpt

Change the current working directory to dirName, or to the home directory (as specified in the HOME environment variable) if dirName is not given. Returns an empty string.

See Also