Basic UNIX
| Nothing seems to stir dread in Windows
and DOS users more than being faced with the prospect of having to use
UNIX for the first time. Yes its true that UNIX is a very sophisticated
operating system with a million commands, but you can most likely do everything
you need as a webmaster with just a few of them. Think about what commands
you use most of the time with DOS!
What you need to find out are the locations of home
directories and web directories. Your host or service provider can fix
you up with this information.
This page is a quick introduction to the several
commands and things you need to know about UNIX. Believe me, you can learn
about UNIX on the 'Net- in fact most of the Internet runs on UNIX servers.
Print out this page, put it on your lap- and voila you too are a
UNIX
Guru!

|
Important
Differences Between UNIX and DOS
Despite common belief, switching your mindset from
DOS to UNIX is not very hard. There are several things you should be aware
of that will instantly make your life easier.
-
The end of file character is control-D,
not control-Z
-
UNIX ends its lines with only a control-J. Remember
to FTP your HTML and text files from DOS to UNIX using ASCII
mode. UNIX will ignore the control-m's, but they look ugly.
-
UNIX is case sensitive. It is important to remember
that IMAGE.JPG and image.jpg are not the same. The normal
convention in UNIX is to use lower case letters, but this is not
law.
-
In UNIX, you do not use the backslash, but rather
the forward slash when referencing directories. The backslash
tells UNIX to take the character after it literally. So cd \dir\dir would
be cd dirdir.
-
cd with nothing after it takes you to your home
directory, it does not print out your present working directory. That would
be the pwd command!
-
UNIX does not have an unerase command. Once you
delete a file, it is gone forever.
-
Command options in UNIX generally use the hyphen-,
not the forward slash.
 |
Navigation:
Same commands, but...
Getting around in UNIX is very similar to getting
around in DOS. The only source of confusion is that when Bill Gates decided
to have PC-DOS support a tree directory structure, he had his car running
in the garage that night. In other words- Whenever you have an urge
to hit the backslash, hit the forward slash key instead.
-
pwd tells you what directory you are in.
-
cd alone returns you to your $HOME directory.
-
cd .. takes you up one level.
-
cd dirname moves you to the directory named "dirname".
 |
File Handling
Unix and DOS have the same utilities for dealing
with files and directories- only some of the names have been changed...
-
cp Works just like copy in DOS.
Syntax: cp file1 file2
-
rm Replaces the DOS erase command.
Syntax: rm file
-
mv Does what rename does in DOS.
Syntax: mv file1 file2
-
mkdir is the same as in DOS.
Syntax: mkdir dirname
-
rmdir is the same as in DOS.
Syntax: rmdir dirname
-
ls is the UNIX version of dir.
Syntax: ls -l shows long (detailed) listing.
Syntax: ls -last shows long listing- newest
first.
Syntax: ls -c is like dir /W
 |
File Permissions
DOS has a limited utility for setting permissions
on files: ATTRIB. In UNIX (being that it is a true multi-user,
multitasking operating system), has a more sophisticated method of setting
permissions: the chmod command. To understand it, let's look at
a small directory listing as made with the ls -l command.
drwxrwxr-x 1 bnb xbignose 1018 Apr 30 23:45 mydir
-rw-rw-r-- 1 bnb xbignose 18755 Apr 30 23:37 mypic.gif
-rwxrwxr-x 1 bnb xbignose 18525 May 4 02:48 mycommand
The permissions are indicated by a series of rwx's on
the left side of the listing. The first position indicates the type of
file. For our purposes it is always a "-" for a file, or a "d" for a directory.
The remaining nine characters indicate the permissions
given to the owner, group, and others. Since owner and other both start
with the letter "O", think of owner as the user. Here is the nitty
gritty...
-
X means execute permission- except for directories
where it means search permission.
-
The first three permission characters are for the user
(owner), the middle three are for the group, and the last three are for
all other people on the system.
-
chmod 775 dirname is the normal permission for
a directory. drwxrwxr-x
-
chmod 664 filename is the normal permission for
a non-executable file, i.e., an HTML or image file.
-
chmod 775 filename is the normal permission for
an executable file, i.e., a shell script. Usually these are not in your
web directory.
Many of you without telnet access that use an
FTP
program such as Cute-FTP or WS-FTP, will have to use the unix command function
of your program. Check the help file with your FTP program for the exact
instructions.

|
Text Editors
The main editors available on most UNIX systems
in order of appearance are:
-
vi. The most popular UNIX editor. Can be found
on every system. Takes some getting used to, but is very addictive! recommended.Here
is an excellent Quick
tutorial.
-
emacs. Very powerful. Very complicated.
-
pico. On screen reminders of comand keys.
 |
For more
documentation...
Every UNIX system has on-line documentation. It
is identical to the paper manual pages. In order to use this feature, you
must be able to access your site and login using a TELNET program.
Getting help is as simple as entering the command:
man command
The man command will format and display the manual
pages for the command you request. Not all of the instructions you will
find will make much sense as ALL options for a command are presented, but
most have simple examples.

|
Congratulations!
Guess what? You have graduated! This pretty much
covers the material of a two day Introduction to UNIX course- retail
value is about $595.
|
|
|
|