ENOUGH UNIX TO GET YOU BY
It isn't my intention to create unix wizards overnight. I'm not
myself! However, a bit of knowledge can be (in addition to a dangerous
thing) useful, and you'll likely fine the unix command line easier
use than the menus once you get the hang of it.
Some basic things to remember:
1. Case is important. cd is not the
same as CD. Most unix commands are
2. Unix is terse. You'll rarely get feedback as to the progress
3. Unix is flexible. Switches can be used to change the way most
4. Online help is available. The "man pages" for most
give you hints and descriptions. There is one fake man page. Can
you guess what it is?
5. You must leave a space between the command and any switches
Initially you are placed in your "home" directory. This
subdirectory of others with your username as the last branch of
tree, something like /users/users1/you.
pwd displays present working directory
cd Change directory. Without any argument,
returns to your home
directory. cd / takes you to the
top (root) directory. cd ..
moves you up one level.
mkdir Make a new directory.
rmdir remove a directory.
Many things that you don't think of as files actually are treated
files. A directory is a special kind of file. The connection to
screen, called a tty from the old teletype days, is a file. Many
unix commands you'll use deal with manipulating files.
File manipulation commands:
ls List files. Gives a listing of
files in the current
-l long. Gives more detail about the
-a all. Include "hidden"
-t time. Sorts in order of time saved,
most recent first.
-F Full. Shows detail about file type.
rm Remove a file.
-i interactive. Ask first for confirmation.
mv Move a file. Can be used to move
a file or group of files
into a new directory, or to rename a file.
Each file or directory has the capability of having permissions
to access. Obviously, you don't want other people reading your
writing to your directories and using your quota. On the other
you might want a .plan file to be readable by others or to make
available for ftp or web browsing. Using the -l switch with ls
you to see the permissions associated with files. Typically a
will look like drwxr-x--x . The first position indicates the type
file, in this case d for directory. The next three characters
the owner of the file (you, if you created it) can Rwad, Write,
eXecute the file. The next three letters show that members of
owner's group can Read and eXecute (but not Write) to the file.
last three letters show that others (the rest of the world) can
(but not read or write) to the directory. Execute permission on
directory allows access to the files within the directory, but
permission is necessary to display the files.
File permissions are changed with the chmod command. Care must
so as not to lock yourself out of a file or directory accidentally.
There are two different formats with which the chmod
command can be
used, the easiest and most positive consists of the following
chmod nnn filename
Where n is a number ranging from 0 to 7, and the positions indicate
owner, group, and all. The number is calculated as follows:
4 = read 2 = write 1 = execute
Just add them up. So, to establish the permissions in the example
you would type: chmod 751 filename
(where filename is the name of the
file or directory).
A file (or several files) can be displayed on your screen with
command. If the files are more than a screenful, you had better
fast reader, as the file(s) will zip right by.
The more command will also display
files, but pauses at the end of each
screen. Hitting the spacebar advances to the next screen.
The less command is similar to more,
but also lets you move back and has
a few other enhancements. So, at least in unix, less is more,
more than more.
cat file1 file2 file3 conCATenates
the files together (and sends them
to the standard output (your screen).
more file1 stops at each screenful.
less file1 works like more, but is
REDIRECTION AND PIPES
You can redirect the input to or output from a file by using the
and > . For example, if you have several text files and you
combine them into a large one, you can use the redirection symbol
this. Example: cat infile1 infile2 infile3
> outfile . This will
conCATenate the three infiles into outfile. You can also use the
symbol to capture the output of a process to a file. For example,
you wanted to mail the results of a finger search to someone,
type: finger user > finger.txt
. This will perform the finger command
and instead of displaying the results on the screen, write the
to a file named finger.txt. You can then import the file finger.txt
into an e-mail composition.
A pipe is similar to redirection, but pipes the output of one command
through another. For example, we can type: cat file1 file2 file3
and the three files will be concatenated and displayed one screen
The commands sx, sb,
and sz are used to Send Xmodem, Ymodem,
from the host unix system to the remote system (your computer).
ask why it isn't sy instead of sb, I don't know.
Similarly, rx, rb,
and rz are used to Receive Xmodem,
etc. from your
computer to the unix host.
Zmodem is the most efficient protocol of the three, if your
communications program doesn't support it, you should fine one
If you have a file on the host system called, for example, foxy.gif
you want to download it to your home system, you need merely type:
sz foxy.gif and away it goes. You
can also use wildcards to speed
repetitive processes. If you have several files that all end in
you can type sz *.gif and you'll
get all such files in your present
directory. Later, you can remove them from the host by typing
To upload a file from your home system to the host, merely type
then use the software option in your communications program to
For text files, you may want to convert from DOS format to unix
and vice-versa. DOS text files use a control-M and a control-J
end of each line, whereas unix text files use only the control-J.
if you upload a document from your home computer it will probably
an extraneous ^M at the end of each line. Likewise, if you download
text from the host to your home system, the text may appear jagged
not print properly. To fix this, use the utilities dos2unix
unix2dos. Syntax is as follows:
dos2unix infile outfile . This will
convert the DOS format infile to
the unix format outfile. You can use the same name if you want,
original file will be overwritten with the new one.
Similarly, you can convert a unix text file format to DOS format
typing unix2dos infile outfile.
There are other ways to do this including option switches for sz
parameter settings on your communications software, but this will
OTHER HANDY COMMANDS
finger Gives a listing of who is on
the system, when they logged on,
and from where.
Displays info on anyone with the name in their username,
first, or last name.
finger -m username Displays info on username only.
w displays a listing of who is on
and what they are doing.
talk Allows 2 users to chat.
ytalk Enhanced version of
talk, allows interactive chat among 2 or
Control-Z suspends a process so you can do something else (like
a talk request).
fg Brings back what you had suspended.
ps Displays what processes you are
running (in case you forgot).
Control-L redraws your screen to erase annoying talk requests.
mesg n prevents annoying talk requests
from showing up at all.
mesg y allows you to see polite (and
annoying) talk requests.
quota -v Shows your disk usage and
du Another display of disk usage.
ping hostname Check to see if a host
is alive or reachable.
pico filename Pine-like easy file
Customizing your shell:
There is a file in your home directory called .cshrc that can be
customized to make things easier for you. For example, if you
initiate talk sessions to firstname.lastname@example.org,
can create an alias so that when you type "trump" the
system thinks you
typed "ytalk email@example.com".
This is called an
alias, and is entered as:
alias trump ytalk rumplestil.... (you
get the idea).
You might want to enter the following alias to prevent you from
accidentally erasing files:
alias rm rm -i
This will substitute the interactive version of the
Also, you'll find that if you change from menus to unix as your
shell, you'll have the more difficult (but more versatile) vi
your default instead of the easier pico. You can fix this by adding
following two lines to your .cshrc:
setenv EDITOR 'pico -t'
setenv VISUAL 'pico -t'
That's it for this intro, check out "A Student's Guide to
Unbound", and "Voodoo Unix" for lots more.
Written by: Floyd Lecureux
Return to the ECS Home