Hardware Reference
In-Depth Information
Using the Command Line
Once you've connected to the remote web server, you
should see something like this:
This is a list of all the files and subdirectories of the
current working directories, as well as their attributes. The
first column lists who's got permissions to do what (read,
modify, or execute/run a file). The second lists how many
links there are to that file elsewhere on the system; most
of the time, this is not something you'll have much need
for. The third column tells you who owns it, and the fourth
tells you the group (a collection of users) to which the file
belongs. The fifth lists its size, and the sixth lists the date it
was last modified. The final column lists the filename.
Last login: Wed Feb 22 08:50:04 2006 from 216.157.45.215
[userid@myhost ~]$
Now you're at the command prompt of your web host's
computer, and any command you give will be executed on
that computer. Start off by learning what directory you're
in. To do this, type:
In a Unix environment, all files whose names begin with a
dot are invisible. Some files, like access-control files that
you'll see later in the topic, need to be invisible. You can get
a list of all the files, including the invisible ones, using the
-a modifier for ls , this way:
pwd
which stands for “print working directory.” It asks the
computer to list the name and pathname of the directory
in which you're currently working. (You'll see that many
Unix commands are very terse, so you have to type less.
The downside of this is that it makes them harder to
remember.) The server will respond with a directory path,
such as:
ls -la
To move around from one directory to another, there's a
“change directory” command, cd . To get into the public_
html directory, for example, type:
/home/igoe
This is the home directory for your account. On many
web servers, this directory contains a subdirectory called
public_html or www, which is where your web files belong.
Files that you place in your home directory (that is, outside
of www or public_html) can't be seen by web visitors.
cd public_html
To go back up one level in the directory structure, type:
cd ..
To return to your home directory, use the ~ symbol, which
is shorthand for your home directory:
NOTE: You should check with your web host to learn how the files
and directories in your home directory are set up.
To find out what files are in a given directory, use the list
( ls ) command, like so:
cd ~
If you type cd on a line by itself, it also takes you to your
home directory.
ls -l .
If you want to go into a subdirectory of a directory,
for example the cgi-bin directory inside the public_html
directory, you'd type cd public_html/cgi-bin. You can type
the absolute path from the main directory of the server
(called the root ) by placing a / at the beginning of the file's
pathname. Any other file pathname is called a relative path .
NOTE: The dot is shorthand for “the current working directory.”
Similarly, a double dot is shorthand for the directory (the parent
directory ) that contains the current directory.
The -l means “list long.” You'll get a response like this:
total 44
drwxr-xr-x 13 igoe users 4096 Apr 14 11:42 public_html
drwxr-xr-x 3 igoe users 4096 Nov 25 2005 share
To make a new directory, type:
mkdir directoryname
Search WWH ::




Custom Search