[Introduction to UNIX for Web Developers]
[Spacer] [Table of Contents]
[Next Page]
[Previous Page]
[Spacer]
The "cd" Command
Cool, so now you know where you are. However, that doesn't really do much for you. What you need to be able to do is move from where your are to someplace else. To do so, you will use the "cd" (change directory) command which is described in the table below:

Syntax Options Example Description
cd option Directory name cd /home/selena/Test Changes the present working directory

As you can see, the "cd" command simply takes a directory name as an option and works something like the following image in which we have changed our directory from "/home/selena" to "/usr/bin/"

[CD Command Example]

Of course you can use relative pathnames with the cd command such as in the following example in which we will change directories using both relative and absolute references

[CD Command Example with relative Examples]

Why not try a few out for yourself. Start by logging in and using the "pwd" utility to get your bearings. Then try moving around. Here are some interesting things to try... (remember to use pwd after the "cd" command so that you can clearly see the effect of the command)

Command Explanation
cd / Goes directly to the root directory
cd Moves you from anyplace on the system directly to your home directory
cd .. Moves you one directory up
cd /usr Moves you directly to the /usr directory
cd /usr
cd lib
Moves you to the /bin directory and then moves you to the lib sub-directory relative to bin.

Previous | Next | Table of Contents