|
UNIX - The cd Command
Using cd for navigation As a webmaster, you should have some idea of how your site is structured.
Specifically, what directories you have created and where you have files located. Using the cd
command is identical to the DOS equivalent of cd. cd followed by the directory name will
move you into that particular directory. For example, lets say you have just telnetted into your account. You begin
at the root of your account structure (which in most cases, you will have your public_html and wwwlogs directory in
front of you) and you need to get to your public_html directory. By typing in cd public_html
you will see output similar to this:
The display will not say where you are. But if you do not get an error, then you have successfully moved into the
directory you are trying to get to.
Moving out of a directory: Moving out of a directory is also very much like DOS. The cd
command followed by two periods (".") will successfully back you out of the directory you are located in. Unlike
DOS, you MUST have a space between the cd and the .. :
No matter where you are located in your directory structure, if you need to get back to your root (maybe you are lost,
or just need to get back to square one), the cd command followed by the tilde (~) will take you
back to your root. The following example commands shows a user: listing the contents of the root, move into the
public_html directory, move into the cgi-bin directory, list the contents of the cgi-bin directory, move back
to the root, and list the contents:
You can also move through multiple directories with one command. If a user is in the root of their account and they
want to go into the cgi-bin directory, which is located in the public_html directory, multiple directory names
separated by the forward slash (/) can accomplish the task:
The final use of the cd command that we will cover is the use of the tilde(~) and login name
to navigate from any location of your account. From any location in your account, you can go to any other directory within
your account with one command. This uses the tilde, followed by your login name, then the directory path. For example,
if your login is sexsite (which you use for ftp, etc), and you wish to go into a directory called
pics, which is located in a directory called members, which is located in your public_html directory, the
following command would be used:
Successfully done, you will receive output similar to the above. Any typos will cause this to fail. Unix is case sensitive
with everything you do. So make sure you have lower case and upper case where applicable to your directories and files.
|