 |
 |
DRH Internet Inc. Website hosting technical support library |
 |
Prereqesites to this document
Simple examples to get you going with Telnet
Once you are at a shell prompt, you need a little bit of ability to get you going and
doing neat stuff. Here is a mini-primer.
Understanding your prompt
Once you are connected, you are given a prompt. In the above connection example the
prompt was "[davideous@w1 home]$". It is possible
to glean some information about where you are from this prompt. First,
"davideous" is the UNIX username I am logged in as,
"w1" is the hostname of the server, and
"home" is the basename of your current directory.
The phrase "the basename of your current directory" means the directory at the end
of your current directory. If your current directory is
"/web/d/a/davideous/home" then the basename
of it is "home". More about this in the next
section on navigating directories.
Navigating directories
When you login you are placed in your home directory. However, you most likely have
other directories that you would like to work in. Here are the commands you will use:
cd - change directory
Enter the name of the directory relative to your current
directory you would like to enter, or the absolute directory name. Leave the argument
blank to move back to your home directory. Or to go back to the parent directory,
use ".." which is an alias to the parent directory.
pwd - print working directory
Prints your current directory.
Here is an example telnet session that shows an example of changing directories. Also
notice how the basename of the current directory in the prompt changes.
[davideous@w1 home]$ pwd
/web/d/a/davideous/home
[davideous@w1 home]$ cd misc
[davideous@w1 misc]$ pwd
/web/d/a/davideous/home/misc
[davideous@w1 misc]$ cd ..
[davideous@w1 home]$ pwd
/web/d/a/davideous/home
[davideous@w1 home]$ cd imap-maildir
[davideous@w1 imap-maildir]$ cd distrib
[davideous@w1 distrib]$ pwd
/web/d/a/davideous/home/imap-maildir/distrib
[davideous@w1 distrib]$ cd
[davideous@w1 home]$ pwd
/web/d/a/davideous/home
Listing files
There are a couple commands which you can use to view the files in your current
directory.
ls - list files
Lists the files in your current directory. Provide the option "-a"
to show the hidden files (hidden files have names that begin with a period). Provide the option
"-l" to show a long listing with file creation dates, permissions, etc.
dir - alias to "ls -la"
An alias to run ls with the "-l" and
"-a" options to that it shows you all the information
about all the files.
tree - show a tree of all the files in this subdirectory
A great little program that shows you a tree listing of all the files in a subdirectory.
You can also ask any one of these commands to list the files in another directory, by
just providing the name of that directory on the command line.
Here are some examples: (Using a smaller font so it will fit in the screen width.)
[davideous@w1 imap-maildir]$ ls
distrib/ help-patch.html index-old.html index.html
[davideous@w1 imap-maildir]$ ls -la
total 40
drwxr-xr-x 3 davideou web 4096 Feb 25 18:30 .
drwxr-xr-x 33 davideou web 4096 Feb 15 20:36 ..
drwxr-xr-x 2 davideou web 4096 Jan 6 09:01 distrib
-rw-r--r-- 1 davideou web 1343 Aug 17 1999 help-patch.html
-rw-r--r-- 1 davideou web 8797 Oct 5 12:12 index-old.html
-rw-r--r-- 1 davideou web 11730 Feb 25 18:30 index.html
[davideous@w1 imap-maildir]$ tree
.
|-- distrib
| |-- imap-4.5-3mdir1.i386.rpm
| |-- imap-4.5-3mdir1.src.rpm
| |-- imap-4.5-3mdir2.i386.rpm
| `-- imap-4.5-3mdir2.src.rpm
|-- help-patch.html
|-- index-old.html
`-- index.html
1 directory, 7 files
[davideous@w1 imap-maildir]$ ls distrib
imap-4.5-3mdir1.i386.rpm imap-4.5-3mdir1.src.rpm
imap-4.5-3mdir2.i386.rpm imap-4.5-3mdir2.src.rpm
Deleting, renaming, and editing files
"rm" is to delete files
"mv" is to move files
"pico" is a good editor to edit files
Creating, deleting, and renaming directories
"mkdir" makes a directory
"rmdir" removes a directory
"mv" renames a directory
"rm -rf" can delete a directory and all the files in it
Chaning your password
"passwd" is the command to change your password