Networking / Beginners

The cd command

The cd command changes the current working directory. The syntax is as follows:

cd directory

You may want to follow the cd command up with a pwd command to make sure that you changed to the right directory. For example:

$ cd /etc/mail
$ pwd
/etc/mail

To change to a subdirectory of the current directory, omit the leading slash from the directory name. For example:

$ pwd
/home
$ cd doug
$ pwd
/home/doug

You can also use the double-dot (..) to represent the parent of the current directory. Thus, to move up one level, use the command cd .. as follows:

$ pwd
/home/doug
$ cd ..
$ pwd
/home
[Previous] [Contents] [Next]