The "cd" Command
July 19, 1998
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 you 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/"
Of course you can use relative path names
with the cd command such as in the following example in which we
will change directories using both relative and absolute
references.
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 /usr directory and then moves
you to the lib sub-directory relative to bin. |
Additional Resources:
The "pwd" Command
Introduction to UNIX for Web Developers | Table of Contents
The "ls" Utility (And Hidden Files)
|