Unix Cook Book
Unix Cook Book
This document summarizes the most generally useful commands of the Unix computer systems available at Mizzou. For
more detailed information consult the Unix man pages available on all the Unix operating systems. Specific Unix systems
often have considerable on-line documentation besides the Unix man pages. Consult the system-specific documentation.
Also, on SHOWME, considerable information is in gopher.
Examples in this Cook Book will show commands on showme.missouri.edu. Called SHOWME for short.
The description of the commands follows the convention of showing them in the Courier font. For Unix commands and
file names: capitalization is significant! Commands and file names will be shown in their appropriate case.
The following Unix systems are available at public computer sites, by dial-up or via telnet or ftp.
* Each workstation has a number associated with it and is part of the host name.
The MU rules regarding proper use of computing say, in general, conserve resources and do not use any resource without
proper authorization. No one may use a student user ID except the student with the corresponding student number.
Those found abusing computing resources are denied access to them and may face suspension or other censure.
More details regarding MU's User ID Policy, Rules of Computing and the Ethics of Computing are available in gopher
in the 3. Guidelines/ section..
showme.missouri.edu
login: _
Your login user ID will be a lower case 'c' followed by your student number if you are a student. If you have a faculty
staff user ID consult the documentation mailed to you by the Campus Computing Help Desk for your login user ID and
default password.
showme.missouri.edu
login: c123456
c123456's Password: _
If you have a student user ID then your default password will be your birthdate in the form of yymmdd. For example:
740607 if your birthdate is June 7, 1974. The first time you login the system will prompt you for a new password. You
will prompted to type in your new password twice (to ensure against typos) so both the computer and you think you
have the same password. Your password will not be displayed when you type it in.
showme.missouri.edu
login: c123456
c123456's password:
You are required to change your password.
Please choose a new one.
c123456's New Password: _
Choose a password that is easy for you to remember but one that isn't easy for someone to guess.
showme.missouri.edu
login: c123456
c123456's password:
You are required to change your password.
Please choose a new one.
c123456's New Password:
Re-enter c123456's New Password: _
Announcements may appear after you login. These login messages will tell you about the machine's availability, system
maintenance, software changes, or any other information that you may need. Read these messages every time you login!
showme.missouri.edu
login: c123456
c123456's password:
You are required to change your password.
Please choose a new one.
c123456's New Password:
*******************************************************
* showme.missouri.edu aix 3.2.5 on rs/6000 590 *
* -- watch this space for announcements 012794 *
* -- utilize "gopher" to access usage info. 012794 *
*******************************************************
showme:c123456> _
This is a shell prompt -- here is where you may enter your commands.
Logging Off
To terminate your Unix session press ^D (Control-D) until your session ends. This won't work if you have previously set
ignoreeof. If this case, you must type logout or exit.
On SHOWME extensive help is available via gopher. Type in gopher from the shell prompt and you'll get a menu that
looks something like:
To ask for a list of Unix commands involving some keyword, enter a command like this:
man -k keyword
or
apropos keyword
To get a detailed description of a specific Unix command or facility, enter something like this:
man command
Specific Unix systems often have considerable on-line documentation besides the Unix man pages. Consult the system-
specific documentation.
Command Format
Where command is the file name of a program. The PATH variable defined by the set command specifies directories that
will be searched for this name. An explicit path name can be specified for a command, for example: telnet can be invoked
by: /usr/ucb/telnet
options are typically single letters with a "-" before them. Options may be specified individually, for example:
ls -l -g -R
ls -lgR
arguments are normally file names, separated by spaces, but can be other things. File names can include wildcards *
and ?. Special characters can be quoted with the backslash \ or single quotes ' '.
The terminal is the default standard input, standard output and standard error message output for most commands. To
send output to or take input from another device, use redirection:
& at the end of a command line causes it to be done in the background. You can type other commands while it is being
processed. See below for session control and job management commands.
Each file name may contain any of the ascii characters and be up to 255 characters in length.
If a filename contains characters special to a shell (such as: > | & ! ? or blank) you must enclose it in double or single
quotes. For example:
Unix files are arranged in a hierarchical structure, much like DOS files are stored. Path names are the vehicles for moving
up and down the directory tree. The directory tree starts with / (called root).
files mail
If I wanted to reference absolutely a file in c123456's files subdirectory it would look something like:
/home/c123456/files/assgn1.c
The total path name length must not exceed 1024 characters.
Your home directory will be: /home/userid. If you are user ID c123456 then your home directory will be:
/home/c123456.
There are two different e-mail systems available on SHOWME. They are Pine and Elm. Both systems are menu driven.
You may choose whichever one meets your e-mail needs.
Pine
Pine is a menu based electronic mail program. To run the program, type pine from your Unix prompt. The first time
you invoke pine, you will see the following screen.
Welcome to Pine...
a Program for Internet News and Email. Pine offers the ability to:
-Access local and remote message folders using a simple user-interface
-Send documents, graphics, etc (via the MIME standard for attachments)
COMMANDS IN PINE: The last two lines on the screen tell you what
commands are available for the current situation. Usually there
are more commands than can be shown on two lines, so use the "O"
key to see what OTHER COMMANDS are available. The "O" is optional;
it is not necessary for a command to be visible before using it
(except when Pine is used in function-key mode; then F2 is required.)
This screen format is common through-out the pine program. Up at the top of the screen, pine will display the version
number of the program, followed by the menu option you are currently working in. At the top right of the screen is the
current folder and how many messages reside there. In the center of the screen are the options from this menu, and at the
bottom the single letter commands for pine are listed.
To Send Mail
• You may press I from the Main Menu to view the notes in your current folder.
• You may press L from the Main Menu to list and change to your other mail folders.
• You may press D to delete a note.
• You may press U to un-delete a note.
• While reading notes, you can save them by pressing S.
You will be prompted to save the message in the "saved-messages" folder.
The message will then be marked for deleting from your inbox.
• Press A from the Main Menu to go to the Address Book option in Pine.
• Press A to add a name to the address book.
Enter their full name as prompted (Last, First)
Enter a nickname to use in Pine
Enter their email address
• To edit a field, move there with the arrow keys or tab and press E.
• You may press D to delete a nickname.
More Details
Notice:
This version of ELM requires the use of a .elm directory in your home
directory to store your elmrc and alias files. Shall I create the
directory .elm for you and set it up (y/n/q)? n
Notice:
ELM requires the use of a folders directory to store your mail folders in.
Shall I create the directory /showme/cctruman/Mail for you (y/n/q)? y
Enter Y at the prompt to continue to set up elm. When it's finished, it will be show you the main Elm screen:
You can use any of the following commands by pressing the first character;
d)elete or u)ndelete mail, m)ail a message, r)eply or f)orward mail, q)uit
To read a message, press <return>. j = move down, k = move up, ? = help
Command:
To Send Mail
More Details
^G Get Help ^O Write Out ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where is ^V Next Page ^U Uncut Text ^T To Spell
Now you are ready to begin typing in your file. You do this by simply typing in your text. When you finish typing your
file press ^o (Write Out). Pico will prompt you to name yur file. Filenames should be fairly descriptive and meaningful
to you and to SHOWME. For example, if you are entering in a SAS program you might want to name it something like
homework1.sas. See File and Directory Names earlier in this Cookbook for more information on naming files.
If you want to edit an existing file, rather than creating a new one, enter pico <filename> from the SHOWME
prompt. Where <filename> is the name of the file you want to edit.
vi is a basic, full screen editor common to most Unix operating systems. The program is actually a combination of vi (the
full screen) and ed (the background macros). You invoke the 'ed' section of the vi editor when you use the ":" commands.
A quick reference is provided here.
Abbreviations
Movement Commands
a number before a movement command repeats that command the number of times. If no number is typed before the
command, the number is assumed to be 1.
Searching
Everything deleted is stored into a buffer. This is done by putting a " and a letter <a-z> before the delete command. The
deleted text will be written into the buffer designated by the letter. To append text to a buffer, a capital letter <A-Z> is
used.
All of these commands are finished by pressing the escape key <esc>.
a append text
i insert text
#r replace # characters
#R overwrite rest of line
#J join # lines together
:s/<string1>/<string2> substitute all <string1> with <string2>
:q quit vi
:q! quit vi without changing file
:w write the file
:w <string> write to file <string>
:w >> <string> append to the end of file <string>
:w! <string> overwrite the file <string>
:wq write file and quit
:f <string> set current filename to <string>
:cd <string> change directory to <string>
:r <string> read in file <string>
x Editor Reference
x is The Hessling Editor. It is intended to be similar to VM/CMS's XEDIT. It is a good editor for those of you who are
already familar with editing files on MIZZOU1 and aren't quite ready to change to pico or vi. Most of the commands
are similar to XEDIT's. There are some differences, however., the function keys being one of these; a table is below.
Settings may vary. Enter show from the command line to see current settings.
F1 SOS Edit
F2 Split/Join
F3 Quit --If nothing has been changed, terminate editing.
F4 nop
F5 Undefined
F6 ?
F7 Backward 1
F8 Forward 1
F9 File
F10 Shift Right 55 columns
F11 Shift Left 55 columns
F12 Do Prefix Command
Movement Commands
Prefix Commands
Printing
The lpr command is used to print files in Unix. The format of the command is:
The most common option you would want to specify is the printer destination, -P. (Notice: this is a Capital P) There is no
default printer destination on SHOWME. If you wanted to print the file homework1.sas to the printer in the in the
Heinkel Computing Lab the comand would be:
Users can submit as many jobs as they wish, but only three jobs owned by any one user can run at the same time. This
prevents any one use from flooding the queues, but still allows for all three machines being kept busy when only one user
is active. More information about the Compute Cluster is available in gopher.