Copyright (C) 1993 Portland State University
This is Edition 0.1 of The Guide,
last updated 7 September 1993 .
Printed 2 September 1994.
Published by Portland State University
P.O. Box 751, CMPS
Portland, OR 97207
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.
This document was adapted from File 901, version 2.0, from the Computer Science Department at OSU. It was originally written by Jon Krueger (University of Rochester) and John Sechrest (OSU).
Contributors to version 1 at OSU were: Joel Corcoran, Edward A. Dains, Chris Hansen, Bryce Jasmer, Cory Jones, Marilyn Jordan, Lothar Kaul, Saeed Sedatian, Dex Smith, Scott Starr, Doug Strauss, Terralyn Udell and Don Willits.
Contributors to version 2 at OSU were: Marcos Barajas, Dan Nixon, Anthony Coughran, Steve Fulling, Dana Jacobsen, Cory Jones, Shahid Khan, Rajeev Pandey, Sheryl Parker, Erik Peteresen, Jason Robbins, Rebecca Ryden, AJ Schricker, John Sechrest, Satish Srinivas and Ricardo Uribe.
With John Sechrest's kind permission, The Portland State University Computer Science Systems Group (Sysgroup) began work on their own version. Initially this was done by converting the document to Texinfo and then omitting or altering local (OSU-specific) information.
The primary work at PSU was done by Lynnette Ahmed, Mihail Blaj, George A. Christian, Roger Conley, Anthony Fiarito, Trent A. Fisher, John Jendro, Laurentiu Popescu and Darrell K. Root.
Some sections are edited versions of documents available on the
Internet. They are section News Etiquette, which is adapted from A
Primer on How to Work With the Usenet Community, by Chuq Von Rospach;
and section nn
, which is adapted from an article by Rohit Gupta
(rohit@uiuc.edu), University of Illinois at Urbana-Champaign, Computing
Services Office.
This manual was written to help acquaint you with the UNIX computer systems available at PSU. It is intended to be an introduction--not a complete guide. If you wish more information about UNIX systems in general, you should read one or more of the books listed in section Books.
This manual is available for checkout at the Reserve Library under the title The Guide.
NOTE: This is still an early version of this document. Please
report any factual, typographical or formatting errors to
the-guide@cs.pdx.edu
.
This section is a copy of the instructions included with the account application form (The Form).
Getting an account on a Computer Science UNIX machine is a two step process: you must fill out an account application, and then run the addme program. If either step is not completed, then you will not receive your account. Once you have finished both steps, you should be able to use your account within one business day.
Account application forms can be obtained from the CS Main office in PCAT 120. You must read this form entirely, and determine what type of account you are eligible for.
If your account just needs to be renewed, just fill out and sign the form and turn it in. Otherwise, have this form with you for the next step.
ADDME is PSU's automated account request system. The easiest way to run addme is to use an X Windows terminal in the CS Lab (MSB 120). Sit down at a terminal, and login as `addme'.
If you are dialing in, press ENTER until you see the prompt `malach>'. Then, type addme twice (once to reach the right machine and the second time to begin the addme program).
Users who wish to telnet in should telnet
to addme.cs.pdx.edu
[131.252.20.183] At the `login:' prompt, type addme.
Simply press return if it asks you for a password. It will then ask you some questions about yourself including asking you to create a password which you will need to remember in order to log in to your account.
Do not choose a password that appears in the dictionary!
Make sure your password is difficult to guess. It should have some
digits and punctuation in it. It should be at least six characters long,
and it shouldn't be anything like your login name or telephone number.
addme
should make sure that you don't choose such a password.
As you give the information to addme you should fill out the form. When you are done with both, turn the form in to the CS Office. You should have your account by the end of the next day.
Go to the Tutors Room in Mill Street Building if you need help with either of these steps. See section Getting Help, for more info.
The Acceptable Use Policy is the primary policy statement for the CS Systems. Some important clauses from this document are on the account form that you fill out and sign in order to receive a UNIX account. Other policies are laid down from time to time in order to give more detail, or elaborate on system specifics. However, this policy has precedence. These other policies can be found in `/folklore' on most CS Systems.
The CS Systems consist of all computer systems owned by, or on loan to, the CS Department.
Sysgroup is the body responsible for maintenance of the CS Systems. The CS Systems Manager is in charge of Sysgroup and, ultimately, responsible for their actions. For further information see section `Introduction' in The Sysgroup Handbook, and see section `Systems Manager' in The Sysgroup Handbook.
The account application form (The Form) specifies the exact policies for who can get accounts and how to do so. See section How to get to a UNIX account for more info.
The general policy is that CS faculty, staff and students (graduate and undergraduate), can easily get accounts. Faculty and staff in other departments may be given courtesy accounts. All others must get special approval from the Department Head.
msgs
facility or the
login message of the day.
Sysgroup, in general, has the right to do whatever is necessary to carry out its responsibility to keep the computing resources operating and available.
The CS Systems are provided for use by faculty, staff and students in support of programs of the CS department. All faculty, staff and students (as well as guest users) are responsible for seeing that these computing facilities are used in an effective, efficient, ethical and lawful manner.
The following list is not exhaustive.
Users who believe they have a legitimate reason to use or develop programs in the above categories for research purposes must consult with Sysgroup and gain permission before using these programs. Special environments may be set up to facilitate the above without causing disruptions to the system.
The software used on the CS Systems is operated under license agreements with AT&T, Sun Microsystems, The University of California at Berkeley and others.
Minor infractions of this policy, when likely accidental in nature, are typically handled internally, in an informal manner. More serious infractions are handled via formal procedure. The CS Systems Committee determines the penalty or rules on whether the case should be referred to another authority.
In general, Sysgroup's first responsibility is to stop the violation (by disabling the user's account pending in-person conference) and then to prevent the violation from happening in the future (by issuing formal warnings, punitive measures, etc.)
Just like in many public establishments, there is a certain level of etiquette that we, as the public, are expected to follow. It is wise to understand what is and isn't acceptable. Failure to behave in a reasonable fashion could result in the loss of computer privileges.
The conventions in this manual are identical to any other manual written using the Texinfo system:
TERM = (termtype) xterms
This chapter explains several ways to get help. When you need help, you should go through the following steps in this order:
man
,
info
/ xinfo
, and gopher
commands.
Several ways to get help are available while you are logged in to a UNIX system. Most of these require typing one of the following commands:
man info or xinfo gopher rn psu.systems
man
and info
are used to get on-the-spot help when you
don't know what to do or you want more information. section Man Command and section Info Command explains them. Gopher
is another
way to get more information and is
described in section Gopher Command. The last one, rn psu.systems
,
is used to look at files of current information about the UNIX systems. Section
section News explains how to use it.
The man command prints pages of the UNIX Programmers Manual on the screen. Each page, called "a man page," describes one command. To use the man command, type the following:
man command
The man command responds by printing on the screen the man page for the command you typed in place of command. For example, if you wished to learn more about the man command, you could try:
man man
Once you have a man page on your screen, you'll want to know the information listed below.
If you don't know the exact name of the UNIX command you're looking
for, you can use: man -k something
man -k
responds by printing on the screen
a list of all the commands it finds that are similar to
the word you typed in place of something or that contain that
word in the description of the command. You can
then use the man
command to get information about the command
you're interested in.
For example, here are the results of using man -k compiler to find compiler man pages.
cccp, cpp (1) - The GNU C-Compatible Compiler Preprocessor. g++ (1) - GNU project C++ Compiler (v2 preliminary) gcc, g++ (1) - GNU project C and C++ Compiler (v2 preliminary) cc (1v) - C compiler error (1) - categorize compiler error messages, insert at responsible source file lines rpcgen (1) - RPC protocol compiler tic (8v) - terminfo compiler yacc (1) - yet another compiler-compiler zic (8) - time zone compiler bdftosnf (1) - BDF to SNF font compiler for X11 cfc (8) - Sendmail cf file compiler ease (8) - precompiler for sendmail configuration files f77 (1) - Sun FORTRAN compiler f90 (1) - Fortran 90 compiler fp (1) - Functional Programming language compiler/interpreter fpc (1) - fp to C compiler orc (1) - The Oregon C++ compiler pc (1) - Pascal compiler sicstus2.1 (1) - SICS Prolog compiler/interpreter sml, smld, smlc (1) - Standard ML compiler
Then you can look at the man page for the C compiler, called cc
,
by typing: man cc
This command should come up with a page with the following sections:
There are other sections that are sometimes used: WARNINGS, BUGS, and others.
On-line man pages are organized into eight specific sections based on the actual commands' purpose. Some systems organize the sections slightly differently. The original eight sections are:
In addition there is a separate hierarchy for each type of software, one for standard UNIX utilities, one for local commands, one for GNU utilities, etc.
The man
command will always try to show you the manual
entry from the correct hierarchy. If you want to see all available
manual pages with a given name use the `-A' argument.
The info
command is part of the Texinfo documentation system,
which is the documentation system used by the GNU Project. It uses a
single source file to produce both on-line help (and other information)
and a printed manual. This means that instead of writing two different
documents, one providing on-line information and the other for a printed
manual, you need write only one complete document.
Most Texinfo documents are intended to be both a reference manual (like the man command in UNIX) and a tutorial. The on-line version of the manual is referred to as an info file, there are several programs available to read them. Currently, the only local machine with up-to-date info files is `rigel'.
There are several commands that allow you to read info-files:
vi
works properly), there is a program called info
.
xinfo
.
With all of these info readers, typing ? will give a listing of available commands. The commands are very similar among all three of these. Typing h will bring up a simple tutorial to show you how to use the info readers.
The entire Info system is organized in an hierarchal fashion, with information at each node. At each level there is a menu of the sub-topics available. At the top level is a listing of the documents available, at the next level down you can select chapters, etc. You can select a menu entry with the m command followed by the name of the node you wish to visit.
The info system also allows you to follow cross references. To do this, use the f command followed by the name of cross reference node.
In either of these cases, you do not need to type a complete nodename;
if you type a few letters and then a space or tab, info
will will
try to fill in the rest of the nodename. If you ask for further
completion without typing any more characters you'll be given a list of
possibilities; you can also get the list with ?
. If you type a
few characters and then hit return info
will try to do a
completion, and if it is ambiguous use the first possibility.
The gopher program is used to talk to gopher servers.(1)
The Internet Gopher is a distributed document delivery service. It allows a neophyte user to access various types of data residing on multiple hosts in a seamless fashion. This is accomplished by presenting the user a hierarchical arrangement of documents and by using a client-server communications model. The Internet Gopher Server accepts simple queries, and responds by sending the client a document.
Most UNIX interactive utilities have some sort of help function builtin. For most commands the ? key will give you a help screen. Some commands may also use h. There are still other possibilities, but you should be informed of them when the program starts
Another way to get answers is to read the news groups `psu.msgs', `psu.systems' and `psu.general'. The CS department systems staff uses the newsgroup for systems information, and answers to common questions. In particular, important systems announcements are posted to `psu.msgs'.
To read these newsgroups use either the rn
or nn
commands. In the case of `psu.msgs'
the same information can accessed via the msgs
command.
See section News, for more information.
Everything you try to do (almost) on these systems is described in a manual somewhere. Relevant manuals are referred to by name throughout this manual, usually at the beginning of the chapter that describes that topic. Some of these manuals can be purchased at Clean Copy or Copyman, and many are available for viewing in the CS Lab (MSB Rm 120).
Publications you may find helpful are:
The UNIX BSD Quick Reference Guide, sold at the PSU Book Store, is a good quick-reference guide to UNIX commands. It gives syntax and brief descriptions of commands similar to those provided in section Basic UNIX Commands.
The definitive published document about UNIX is the UNIX Programmer's Manual. System V, HP-UX, and BSD UNIX have slightly different versions of it.
Volume 1 of the UNIX Programmers Manual consists mostly of documentation written for programmers. It documents mainly software in little space.
Most of Volume 1 of the UNIX Programmers Manual is kept on-line. section Man Command explains how to utilize it.
Recently, a number of paperback books about UNIX have come out. These books can give you a broader perspective on UNIX than the manuals provide.
In addition, there is a series of books called the Nutshell Handbooks published by O'Reilly. Titles in this series include:
O'Reilly also publishes a series of books on the X Window System (see section X Environment, for more info.)
You can purchase most of these at the Powell's Technical Bookstore, 503-228-3906, or check with O'REILLY and ASSOCIATES, INC., 632 Petaluma Avenue, Sebastopol, CA 95472 or mail nuts@ora.com or phone 1-800-338-6887(NUTS).
In a highly networked group of computers such as the one that the Computer Science Department runs, troubleshooting users' problems can be a complex task. This section is intended to help users report problems to the appropriate people. It tells them what information to supply about their problem, and what they should expect.
It is vitally important that these guidelines be followed. If they are not, your problem may not get solved or you may take time away from Sysgroup members (which will prevent other systems work from being done).
The CS Tutoring Staff should be the first place to report problems or ask questions. If they cannot resolve the problem, they will refer you to someone who can (or they will do it themselves).
script
command.
Tutors are available to help you. They are there to help you find the resources you need to do your work. They are not available to do your homework for you or as a substitute for the manual. They are there to provide as much direction as possible and to help you over places where you might have become stuck. It will help you (and the tutor) if you come prepared: see section Before You Go, for more information.
The student tutors can be found in the Tutor Office in the CS Lab (MSB Rm 120). During school sessions, they are available whenever the lab is open. (A full list of hours is posted by the door.) If the student tutors are unable to answer your question, they will refer you to someone who can.
They can also be contacted via telephone at 725-4023.
If you don't need an immediate answer, or if the lab is closed, you can send email to `tutors' with a detailed description of your question or problem.
If you are able to send E-Mail, send it to `sysgroup'. This mail will go to the entire Systems Staff and to the Tutoring Staff. If you only want to report it to the Tutors, send mail to `tutors'. E-Mail sent anywhere else may not get answered at all, as there are people and programs monitoring both `tutors' and `sysgroup' to make sure that mail is responded to in a timely manner.
All mail to or from Sysgroup is now monitored by a program called
GIPR
. There is little the user should need to know about this,
except that its role is to keep track of what is being done within
Sysgroup and to make sure that deadlines are met, messages get
responded to, and
that no messages get "lost". When you get a response from a Sysgroup
member, there may be header elements which indicate the priority for
your problem and the estimated date of completion: `Priority:' and
`Estimate:', respectively. Also, you should use the reply function of
your mailer when responding to messages from Sysgroup members; this way
GIPR
can automatically corelate your message to an existing task and
keep the statistics accurate.
More information on GIPR
is available in the
section `Task System' in Sysgroup Handbook.
If you have a problem which needs attention immediately, put the keyword `[URGENT]' on the subject line of your message. However, this can result in someone getting paged; therefore, please read the warning below about the pager before doing this. Conversely, if your message does not warrant any action on Sysgroup's part (i.e. announcements), put the keyword `[I]' on the subject line.
You can also report problems via the telephone, however this is the least desired method for reporting problems, since it can be difficult to communicate the details of the problem (i.e. complex error messages). However, due to the large number of evening and off-campus classes, sometimes this may be your only choice.
The following numbers should be tried in the order given:
WARNING: the last number should only be used in dire emergencies. If you do use it, make sure that you leave a phone number where you can be reached. If you don't, odds of anything being done are very low.
Introduction
This chapter explains how and where you can access your UNIX account. You need to have some sort of terminal that connects you to your UNIX machine. Most personal computers like Mac's and PC's can run a program that will emulate such a terminal. How to run and use these programs is described in the section Logging on from the Computer labs on campus. The section Basics of logging in and out describes how to log in and out of your account once you have connected to the machine.
Once you have connected to the UNIX machine, you will see a prompt similar to:
`login:'
You should now type your login name. After you've typed that, you will be prompted for your password. Note that your password will not appear on the screen while you type it (this is for security purposes). If you have typed everything correctly, you have now successfully logged into the machine. Most machines will next display a message. If you are logging in from a non-X terminal, it will then ask you for the type of terminal you are using, like this:
`TERM = (something) '
You should now enter the type of terminal you are using or emulating. If you are using a Mac or IBM it will most likely be VT100. If you are using an X-terminal, the terminal type will be set automatically to xterm. Often times the computer will already know what term type you are using and display it in the parentheses above instead of the word "something". If this is the case, then you need only to press return. Once you have done this you should see a system prompt with the name of the machine you are using, such as this:
`sirius%'
When you see this prompt, you are ready to begin using your account.
After you have finished using your UNIX account, you need to log out. If you are at an X-terminal, move the mouse cursor over the Logout button window in the lower right corner of the screen and click the left mouse button. You can also exit you session by choosing the EXIT, option from the utility menu. To open you utility menu, just press the left mouse button on the root window (root window is the background window).
If you are at another type of terminal, you type
logout
at the system prompt. You can also type Ctrl-D to logout. If you see the line
`There are stopped jobs.'
you will need to type logout again, which will kill all the stopped jobs. Jobs are typically stopped by typing Ctrl-Z. To find out more about Jobs, See section Controlling Jobs.
The Computer Science Lab is located in Room 120 of the Mill Street Building, which is located at 528 S.W. Mill Street. It provides access for students to their UNIX accounts on the computer science machines. Tutors are available to answer questions and help with problems. To find out the hours that the lab is open, call the tutors at 725-4023.
The Computer Science lab has more than 20 X-terminals. You can log on to your UNIX account using any of these. There is also an IBM PC for uploading and downloading files to diskettes.
To use the X-terminal you must have an account on the machine that hosts the X-terminal. Ther host name is givin in the XDM window.
Enter your login name and password in the XDM login window.
Now, the window manager specified in your .xsession file in your home directory will be started. (Or if you don't have a .xsession file, the default one will be used.) You will see the `machine-name%' prompt, and may begin your session.
For more information on starting a different window manager, or customizing your .xsession file, see Section See section X Environment.
Turn the machine on and wait for it to boot. At the C> prompt, type
telnet fully-qualified-machine-name
The default terminal type is vt100. The IBM is used mainly to upload and download files between your UNIX account and floppy discs. It can use both 3 1/2 and 5 1/4 floppies.
To connect via modem, you need to make sure you have the following settings made:
Also, make a note of the type of terminal emulation your program is set for so when asked what term type you are using, you will know what to enter.
The phone number that you can call to connect to the PSU Cisco Terminal Server, hostname malach, is 725-3144. These numbers automatically switch between the other full time modems available.
Once connected, you may need to press "return" a few times to get the `malach>' prompt. Once you see this prompt you can type machinename to connect to your machine. For example, the following would connect you to the machine sirius:
`malach> sirius.cs.pdx.edu'
If you have some problems while dialing in, try the following steps:
If you have problems with dialing in you should mail a trouble report to:
`psu.dialups'
or call 725-4023 and report the problem to the Computer Science Department tutors. The next section, Reporting Problems, will explain what information to give when reporting the trouble.
To report any trouble you may be experiencing, your report needs to have some specific information to aid in locating the offending hardware or software. Each communication system has several possible points of failure. Possible failure points are: phone line, answering modem, serial cables from modem to communications system, malach, or the host to which you are connected. If you are able to get as far as the malach prompt, type who at that prompt to find out which malach port you are connecting to and include that information when you report your problems. Also report which phone number you dialed. Give a description of what happened. Mail reports of problems to psu.dialups, or post an message to the newgroup psu.dialups.
All modems in the CS department are on Malach, the network terminal-server. When you first dial in, hit return twice, then follow instructions given in the message header. Type "help" for information on additional commands.
In order to trace problems, users experiencing problems need to supply as much complete and accurate information as possible. The following is a list of information to supply when reporting problems. Examples showing how to get most of this information follows the list.
Examples ========== Phone number dialed? ______________ (725-3144) Did you get the Malach prompt after the "CONNECT" response from your modem? ______________ (yes/no) Was there an error in connecting to the host? ______________ (yes/no) What was the error message? ______________ Could you connect to other hosts? ______________ (yes/no) What software are you using to connect --------------
From malach, the response would be `HOST NOT RESPONDING.'
The best way to report a problem is with the description of what you think the problem is, followed by a log of what happened. If you are unable to get the backlog of the session and problem, then the appropriate information will be needed, i.e. phone number, port, etc.
This chapter is a quick introduction to some of commands available under the UNIX operating system. For more information on any of these UNIX commands refer to the man pages, described in Section See section Man Command.
UNIX understands several control-key commands, commands you enter by holding down the control key (ctrl) while striking a second key. Listed below are some of the UNIX control-key commands:
fg
command to
continue the program, see section Controlling Jobs)
command -options arguments
The command is always the first word. The options modify the function the command performs. The arguments identify the data (usually a file or files) upon which the command performs its function.
This syntax is almost universal within UNIX, but not quite. A few commands take options without the preceding dash, and some commands accept dashes but don't require them. Some commands require a dash for each option, instead of permitting you to group several options after one dash. If you have questions about a command's syntax, refer to the man pages (explained in Section See section Man Command) as the final authority.
Three additional areas you should know about using UNIX commands are: abbreviations, upper- and lower-case, and wild-card characters. The first two are simply explained:
The third is only a little more complicated. UNIX shells have two wild-card characters: ? and *. The ? character is used to match one character. For example, if you tell the system to find file ???, it will return all the file names that are three characters long. The * character is used to match file names containing a varied number of characters. For example, if you tell the system to find m*, it will return all the file names that start with `m' (for example, `me', `mother', and `mary' would all be returned). The * character can also be used before partial file names (for example, *.lis) and on both sides of partial file names (for example, *.*). A useful expression is .??* which matches all files beginning with a `.' and are at least 3 characters long. Files beginning with `.' are typically not displayed.
Some common UNIX commands are listed below according to how
they're used. Complete information on each of these commands is
available via the man
command (see section Man Command, for more
info).
More information on dealing with files can be found in section Unix Files & NFS.
All modern computers have some means of on-line storage of user data. This data is available immediately to users upon demand, via names, which are supplied by the user. In order to deal with this data, the operating system provides a consistent set of tools allowing users to create, store, retrieve, modify, and otherwise delete files. Files are usually stored physically on some system's hard disk, which is divided into many blocks, much the same way a parking lot is divided into slots, allowing many cars (disk blocks) to park (be stored) in an orderly fashion.
This discussion will give you a general understanding of unix files. After reading and understanding this chapter, you should be familiar enough with unix files to:
An ordinary file holds data. This data can either be ASCII text (consisting of characters from your keyboard), or binary (generally a machine generated file). An example of an ASCII text file would be some program source code listing; an example of a binary file would be the command ls. The unix operating system supports both random and sequential access on any ordinary file. The majority of all your file experience will be with ordinary files. Ordinary files are usually created using text editors, compilers, and other unix commands.
Files can use almost any character. Normally files that begin with a
`.' do not get displayed by commands that list files like ls
.
These dot files are very important. Most programs use files like
`.cshrc', `.newsrc', `.login' and `.emacs' to alter
the initial configuration of the program. You will see more later about
dot files as you read about each program.
A directory is a unique file that again holds data. Only here, the
data is restricted to being a list of files (the contents of the
directory). This list of files (directory) can be any type of file
--- ordinary, directory, special, or a link. All directory files are
maintained by the operating system, via some file related command or
system call. Directories are usually created with mkdir
and
removed with rmdir
.
A very special directory is called your home directory. This is the directory where you are put when you first log in. This directory is the location where all of the programs will search for thier initialization files.
Special files are files that usually deal with some sort of I/O
device. Some examples include: printer, tty, disk, and tape devices.
Special files are usually owned by root, and should usually never
need manipulation by a standard user. Special files are usually
created with mknod
.
Unix supports two kinds of link files--a hard link and a symbolic link. A hard link is actually a file with the address space of some ordinary file's data blocks. Once a hard link is established to some file, it becomes indistinguishable from the original. It is like having two identical copies of the same file. If you modify one, the other is modified, etc. On the other hand, a symbolic link is just a reference to another file. It contains the pathname to some other file. If you remove the file it points to, then the symbolic link points to a non-existent file. Hard links are created with the command ln. To create a symbolic line, use ln -s. For example, to create a symbolic link of your USENET directory into you mail directory for use with MH, you would say
ln -s News Mail/news
The unix file system is hierarchical. The top of the tree is referred to as `root'. The complete list of directories that must be traversed to access a given file is referred to as it's `pathname'. Your home directory (default directory where all your files will be stored) will usually be somewhere in the middle of the unix file tree. An example of a unix file tree is shown.
/ (root) |\ /|\ \ / | \ \ / | \ \ / | \ \ etc bin tmp users | | | / \ | / \ ls joe sam / / foo
All files have an absolute pathname (or full pathname) and infinitely many relative pathnames. If `joe' is a user of this system, the pathname to his home account would be `/users/joe'. If he had a file called `foo' in his home directory, it's full pathname would be `/users/joe/foo'. If you were in /users, it's relative pathname would be `joe/foo'. The following concept is what allows infinitely many relative pathnames.
In every directory there are two (2) files that are created by the system when the directory is created. They are `.' and `..'. These files allow relative access to a file. The `.' means the current directory and the `..' means the previous directory. For example, if I am in joe's home directory (/users/joe), and I wish access his file `foo', I can reference it by `./foo', `../joe/ foo', `../joe/./foo', etc.
Unix provides many commands to handle files. I will outline, briefly, the basic ones - ls, cd, cp, mv, and rm.
To use cd (change directory), you must
give it an argument of which directory you wish
to cd
to. For example, if you're in your home
directory and issue cd /usr/bin, you will be in
the directory of /usr/bin. If you wish to check
this, issue the command pwd (present working
directory), which would give the output: `/usr/bin'
As an experiment, do a pwd of your home directory. What is this telling you?
The command ls will, among other things, list the contents of the current working directory. An ls of `/usr/man', will usually give the following output:
cat1 cat3 cat5 cat7 man1 man3 man5 man7 manl whatis cat2 cat4 cat6 cat8 man2 man4 man6 man8 mann
ls will probably be your most useful command. ls supports many options (also called switches). A few will be used in the following discussion. The commands cp, mv, and rm directly manipulate your files. cp copies files, mv moves (or renames) them, and rm removes them. If you wish to copy a file foo to a new file boo, enter:
cp foo boo
If you wish to move `boo' to `coo', enter:
mv boo coo
And finally, if you wish to remove `coo', enter:
rm coo
After reading the rest of the chapter on Unix Files, you will discover many different and interesting ways to manipulate files. You may also be wondering how to create files in general. Files are usually created by editors, compilers, or direct unix commands. After a while, files will seem to `pop' up all over!
The command ls (with various switches) will display different items of a file's status. There are many pieces of information located in a file's status. For instance, to view a file's last modification date, do an ls -l on the file. Here is what ls -l returns on our example file `foo':
-rw-r--r-- 1 tot 2437 Sep 8 15:59 foo
This file has been modified on September 8, of the current year (if it is a previous year, the time will be replaced with the year), at 15:59 hours (3:59pm).
To view a file's `last access' date, do a ls -lu on file foo:
-rw-r--r-- 1 tot 2437 Sep 8 16:11 foo
Here, you can see the last access date is September 8, at 16:11 hours. With the ls -l command, you can also obtain the file's permissions. These permissions determine who can read, write and/or execute a given unix file. To understand a file's permissions, you must first understand the concept of owner, group, and other. The owner of a file is usually the person who created it (although it may be changed). The group ownership of a file is a collection of users who group own your file. Finally, other is any other user on the system.
The reason unix has all three is because you may wish to give only the owner (generally yourself) the ability to read and write your file, while allowing the group to only read it, and the rest of the computer's user community, no access to the file at all. So, with a few commands you can protect your files reading, writing, and execution policies between three different domains (owner, group, and other).
When you view the output from a ls -l, you will notice on the far left, there will be dashes and letters. This is the 9-bit access control field of a file's status. The first three bits (starting from the left) represent the owner, the next three (middle) represent the group, and the last three (on the right) represent all others. Moreover, the `r' stands for read, `w' for write, and `x' for execute. So as you can see from doing a ls -lg on foo, produces:
-rw-r--r-- 1 tot staff 2437 Sep 8 15:59 foo
Here, tot (the owner), has read and write privileges, staff (the group) has read privileges, and all others also have read privileges. Consider the following output:
-rwxr-x--x 1 tot staff 2437 Sep 8 15:59 foo
In this case, tot (the owner), has read, write, and execute privileges. The group staff, has read and execute privileges, and all others can only execute it.
A few more words on file status. The `1', just to the left of tot in the above output, shows how many links the file foo has. These links refer to hard links, since a symbolic link really has no explicit association to a file. If you do a ls -l on a symbolic link called say, `boo', pointing to file `foo', it would look like:
lrwxrwxrwx 1 tot staff 3 Sep 8 17:10 boo -> foo
Notice, the `l' (ell) on the far left of the 9-bit permissions field. This signifies, that the file `boo' is a symbolic link. Lastly, where you see the 2437 in the following output from ls -lg:
-rw-r--r-- 1 tot staff 2437 Sep 8 15:59 foo
this is how many bytes the file is using.
There are a few more file status items that I will not discuss here;
however if you wish more information on this, you may want to do a man
on ls
. (man ls)
There are two ways to change a file's permissions. The first way is to set the permissions with a text string. Say we wish to make a file owner=read, group=read, and other=read. To do this we would do
chmod ugo=r foo
where u=owner, g=group, and o=other, and foo is the filename. Now doing an ls -l, will produce the following output:
-r--r--r-- 1 tot 2437 Sep 8 15:59 foo
Alternatively, (from `foo''s current state), we could do:
chmod u+wx foo
where the `+' means add to the current permissions, produces:
-rwxr--r-- 1 tot 2437 Sep 8 15:59 foo
This method should be obvious by now. The second method uses three sets of binary numbers, converted to decimal. So, if you wish to give owner read, write, group permission and all others read permission, enter:
chmod 644 foo
where the first digit is for the owner, second is for the group, and third is for all other, would produce:
-rw-r--r-- 1 tot 2437 Sep 8 15:59 foo
Notice the 644 is easily extracted from `-rw-r--r--'.
6 4 4 | | | 4 + 2 | | \ | | | \ | | | 421 421 421 rw- r-- r--
All you have to do is look and see which bits are turned on, add them up and, poof, you have your number to call chmod with. Say you wish read, write, and execute (rwx) on owner, read and execute on group and all others (r-x), enter:
chmod 755 foo
-rwxr-xr-x 1 tot 2437 Sep 8 15:59 foo
Figure shows how you can obtain 755 from `-rwxr-xr-x'.
7 5 5 | | | 4 + 2 + 1 4+1 4+1 \ | / | | | | \ |/ | | | | 421 421 421 rwx r-x r-x
You may take your pick of whichever method you prefer. Directory permissions work the same way, except what it means to execute a directory is basically permissions to list the contents of it. Hence, a directory of:
drwxr-xr-x 2 tot 512 Sep 8 17:46 foo
(notice the `d' on the far left, that means it's a directory)
this means the owner tot, may read, write & execute it (cd into it and list it's contents). It is uncommon to only give a user read privilege to a directory and not execute, although you may. This would allow one to read from your directory but not list it's contents.
One more thing, if you wish all files to be created with some certain permissions, use umask. For example, if you issue umask 022 you will mask all your upcoming created files with 022, thus producing a newly created file with permissions (644):
-rw-r--r-- 1 tot 2437 Sep 8 18:12 foo
If you do a man on umask
(man umask) it will explain in more
detail about file masking.
-rw-r----- 1 tot staff 2437 Sep 8 18:12 foo
You may read the file `foo'. On most systems you can issue the command groups and it will list all groups to which you belong.
The group access to a file can be used to safely share files between members of a group and not anyone else. To change the group of a file, use chgrp. For instance if you wish to change file foo to group bin, execute:
chgrp bin foo
Then the file would look like (after doing a ls -lg):
-rw-r--r-- 1 tot bin 0 Sep 8 17:51 foo
However, in this case, you usually must be a member of the group you are changing to, or the system will not allow such a command. To have a group created, if one does not exist with the people you want to share access to a file, you will need to contact sysgroup (see section Sysgroup, for more info.) If you wish to change the ownership of a file, use chown. For instance if you wish to change the ownership of file foo to joe, execute:
chown joe foo
Then the file would look like (after doing a ls -l):
-rwxr-xr-x 1 joe 2437 Sep 8 15:59 foo
However, you usually can not change the ownership of a file, unless you have super-user privileges.
The concept of setuid files means that if you have the setuid bit turned on on a file, anybody executing that command (file) will inherit the permissions of the owner of the file. So if you have the following setuid file:
-rwsr-xr-x 1 tot 2437 Sep 8 18:12 foo
This means, that when any user executes this file `foo', he will inherit tot's uid (which means he inherits all their file access permissions whether you're tot or not). Note: this can be quite dangerous. If you have a setuid shell owned by yourself, and I execute it, I essentially inherit your file permissions, hence have the ability to remove all your files.
In the above output, the reason for the small s means there's an x (execute) under it that's hidden. If it were a large S as in:
-rwSrw-rw- 1 tot 2437 Sep 8 18:12 foo
This means there's no x under the S. In order to make a file setuid, you prepend the three digits given chown with a 4, or use the s option. For example to get the first output:
-rwsr-xr-x 1 tot 2437 Sep 8 18:12 foo
I did a chmod 4755. The same is true for group, except use a 2 instead. If you want both, add them, to get 6. Hence a file with chmod 6755 would look like:
-rwsr-sr-x 1 tot 2437 Sep 8 18:12 foo
Again, notice the small s. What does that mean?
The term file system actually has two (2) meanings. First it refers to a software mechanism that is generally responsible for the management of all on-line files. Secondly, the way we will use the term filesystem, refers to a given subset of a physical disk drive, divided into some defined number of disk blocks.
All files are usually stored on some type of file system. Most file systems on any given machine will usually be either local (meaning the disk is physically located on that machine), or NFS (having the disk physically located elsewhere).
NFS is a network file system originally developed at Sun. With NFS, you may have a physical file on one system facilitating access to it on another. Under NFS there exists a concept of an NFS server and an NFS client. The server is the system that has the physical space and the client is the system that mounts that space (meaning that space is available). A system may act as both an NFS server and an NFS client. Moreover, any file system on a server is also available locally within that system.
From the user perspective, NFS should be transparent. Really, from the user's view, the only way to identify whether a certain file system is mounted NFS, would be to do a df. A typical df would look as follows:
Filesystem kbytes used avail capacity Mounted on /dev/sd0a 14095 11292 1393 89% / /dev/sd0e 95942 83083 3264 96% /usr /dev/sd0d 2335 319 1782 15% /tmp lynx:/src 623486 540682 20455 96% /nfs/lynx/src lynx:/usenet 582110 290034 233865 55% /nfs/lynx/usenet shale:/fog/local 189369 148562 21870 87% /nfs/shale/local shale:/u1 322658 253664 36728 87% /nfs/shale/users frisby:/spare 454838 377286 32068 92% /nfs/frisby/spare frisby:/u1 453799 375705 32714 92% /nfs/frisby/users
Here you can see this system has three (3) local file systems, and six (6) NFS mounted file systems. Consider the following line, from the above output:
lynx:/src 623486 540682 20455 96% /home/rigel/src
Here, the `lynx:/src' means the NFS server is lynx and the file system we are mounting is `/src'. The next four (4) fields show statistics about disk space over that file system. The last field, `/nfs/lynx/src', shows where on your local system the lynx:/src file system appears. So for example, if you did a cd to `src' on rigel and do an ls, you would get the same listing from ls if you did a cd to `/home/rigel/src' on this system and did an ls. This /home/rigel/src is a convention established here at PSU. On our machines all NFS file systems are mounted under /home/machine-name/file-system, so in the previous example, machine_name was rigel, and file_system was bacon.
NFS provides a means of allowing file systems form one system to appear on another. Again, this should appear transparent to the user.
The following is a table describing some simple unix file commands and their usage. For further information regarding these commands, or any unix command in general, do a man command.
This list of file system commands is in no way exhaustive. There are many more commands available to manipulate unix files. For more information, see section Basic UNIX Commands.
Introduction
Email allows you to send letters to another user's "mailbox" that he or she can read at any time. This chapter describes UNIX email and three different mail programs: Berkeley Mail, MH and Elm. Berkeley mail is a general purpose mail program. MH is an advanced set of tools that offers increased flexibility in using mail. Elm is a user friendly menu type program. There are other mail programs, but these are the ones that are used most often at PSU.
To send mail, you need to know the login of the person who is going to receive your mail. In order to find this, you can use finger in the following way:
finger name
Replace name with the name of the person you want to send mail to. A name may be a first or last name, or an account name.
For example, suppose you want to send mail to Moe Howard. To find his login, you'd type the following:
finger howard
(You could also type "moe" instead of howard.) Finger would return something like the following:
`Login name: moeh In real life: Moe Howard'
In this case, Moe's login, and mail address, would be:
`moeh'
If this person didn't have an account on the machine you're using, finger would return:
`Login name: moeh In real life: ???'
Even though this person may not have a login on the machine you're using, they might still be available by email if they have a login on some other machine. You could find their login by typing:
finger name@hostname
For example, if you know that Moe Howard has a login on rigel, you can type:
finger howard@rigel
Say, this returned:
[rigel.cs.pdx.edu] Login name: moeh In real life: Moe Howard Directory: /home/rigel/mayo/moeh Shell: /bin/csh On since Sep 10 08:08:35 on ttypf from callisto.cs.pdx. No unread mail Project: No Plan.
Then Moe's complete mail address would be moeh@rigel.cs.pdx.edu.
Finger will only work on those directly connected Internet sites that have it configured. It will not work though mail gateways or through corporate firewalls. If you find that finger does not work, the best alternative is to use the phone and call the person you are trying to reach to get an email address. Some places like MIT and University of Illinios are setting up campus wide directory systems based on finger. But most place are not yet providing this type of directory service, in fact some have finger disabled.
Note: you may also attach domains to the machine name. Please read the following section (Berkeley Mail) for an explanation of domains.
Once, you've established the person's login to which you wish to send, simple enter:
mail login
So, if you wish to send mail to moeh, you would enter:
mail moeh
If this user was on the machine rigel, you would enter:
mail moeh@rigel
After this point, the program mail will prompt you for the subject and body of the mail message. To end a mail message you typically enter Ctrl-D or a single dot (.) on a blank line.
When sending mail to moeh@rigel it should be noted that moeh is a user on the machine rigel. This machine is located under some domain.
A domain is a string of words separated by periods. Lower-level domains are arranged left to right, in ascending order, ending with a top-level domain. Any number of lower-level domains may be used.
A domain may represent a subdivision of an organization (at any level), or an individual host computer. The following is a list of some of the domains that are found on the PSU campus, and thier associated departments:
So, if you wish to send mail to a user in another domain, you would enter:
mail login@machine.domain
As you can see, the key to sending someone mail is locating their login, machine, and domain. So, as a review, if the user you wish to send mail to is on the same machine as you, enter:
mail login
If they are in the same domain as you, enter:
mail login@machine
and if they're outside your domain, enter:
mail login@machine.fully.qualified.domainname
To receive mail, type the following command:
The mail facility responds by printing a list of letters that are in your mailbox. This list looks something like the following:
Mail version SMI 4.0 Wed Oct 23 10:38:28 PDT 1991 Type ? for help. "/usr/spool/mail/moeh": 1 message 1 new >N 1 moeh@rigel.cs.pdx.edu Wed Sep 1 12:31 20/643 Help &
In this list, "moeh" is the login of the user who sent you mail, and the quoted section on the right is the subject of the message.
Once inside the mail facility, you can do a variety of things, including the following: scan through the subject headings of your letters, read your mail, reply to it, delete it, forward it, or save it into files. The following is a list of commands that you can give a the ampersand (&) prompt:
and
recipient(s)
For a more complete list of mail commands, type a question mark (?) in response to the mail facility's ampersand (&) prompt.
The mail program can be configured by editing the file .mailrc. This file will let you define aliases and customize how mail works. Below is a example .mailrc file. Please read the man page on mail to find the details of the initialization parameters.
# .mailrc -- initialization for mail(1) # set append # ask for the subject ask #start using the pager if the message is bigger than 22 lines. crt=22 dot folder=Mail hold set nosave quiet #Don't display some header lines ignore received message-id status # set up an alias alias rms rms@gnu.ai.mit.edu
This section describes some other forms of addresses when sending mail to users who are not on the same system as yourself. There are many different mail systems and many different ways to connect between them.
mail login@site.network
Replace site with the name of the site where the person login identifies is, and replace network with the name of the network that person is on.
For example, the following command sends mail to someone who's login is "echo," who is at "hp-pcd," and who uses the "uucp" network.
mail echo@hp-pcd.uucp
There are other networks as well as uucp. Another example is the bitnet net. A possible mail command might be:
mail lstsru@orstate.bitnet
Earlier in this chapter there was a discussion of domain addresses. It is important that a domain is specified when sending mail. The only exceptions are when you are mailing within the sub-domain cs.pdx.edu. That is, all machines in the Computer Science Department do not require that a network is specified, if you are mailing from a CS machine. For review, if your machine is in the Computer Science Department, then your return address is:
`login-name@machine-name.cs.pdx.edu'
If you need to send to an address in which there is no direct access to the network, you need to make use of secondary parsing. In other words, you can have "someone else" figure out how to get the mail to go where it should go. The format is:
mail login%site@relay-machine-name
Replace site with the name of the site where login is. site can include the network name. For example, if you want to send mail to someone who is on the BITNET, you can use secondary parsing. In general addresses of the form user@site.BITNET will work, this is just an example of secondary addressing. In the above format the @relay-machine-name indicates the "someone else". So the command:
mail wyatt%cfa2.BITNET@CUNYVM.CUNY.EDU
would be handled as follows. The machine that you mailed the message from would send it to orstcs, our nameserver. Orstcs would see the @CUNYVM.CUNY.EDU and know to send it there. The @CUNYVM.CUNY.EDU would subsequently be stripped off of the initial address. CUNYVM.CUNY.EDU is one of our gateways to the BITNET, so when the machine there saw wyatt%cfa2.BITNET it would know to send it on its way through the BITNET. BITNET addresses are of the form user@host, so CUNYVM.CUNY.EDU would strip off the .BITNET and change the % to an @.
You should remember that in secondary parsing the address is parsed from right to left.
The following is a table outlining how to send to different networks from the Internet:
After you type the command to send mail, the system may prompt you for a subject. Your subject may be up to one line long.
After typing the subject (if your system prompts you for one) , you can type your letter. Note that mail doesn't have a prompt when you're sending mail; it just sits there waiting for you to type. You can enter as many lines of text as you want.
To get help while in the mail facility, type the following:
? on a line by itself followed by a carriage return
This will bring up a collection of commands that can be used from inside a mail message. The most useful of these is v, which causes your mail message to be put into an editor (default vi) so that you can edit the mail message. (This looks at the value of the VISUAL environment variable. Change this variable if you want to use a different editor)
If you decide in the middle of typing your letter that you don't want to send the letter or that you want to save it and finish it later, type ctrl-c twice. This saves the contents of your letter in a file called "dead.letter." You can then delete the dead.letter file or edit it and send it at a later time. To send a letter that you saved in the dead.letter file, type the following:
mail -s "subject" login < dead.letter
Note
: If the letter is not saved into dead.letter, and you want
this option, your .mailrc file will have to be modified.
Invoke an editor and bring up your .mailrc file. Remove
only the word "nosave" from the file. Save the file.
From then on, each time you use mail, the cancelled mail
will be saved in the file dead.letter.
When you're done with your letter, type ctrl-d to get out of the mail
facility and back to the UNIX prompt. When you type ctrl-d, mail
sends your letter to the user who's login you named when you invoked
mail.
Note
: Taken from the MH man page.)
MH is the name of a powerful message handling system; it is an alternative interface to the UNIX mail system. Rather then being a single comprehensive program, like most mailers, MH consists of a collection of fairly simple single-purpose programs to send, receive, save, and retrieve messages. The user should refer to the MH User's Manual and the man pages for the MH program for more details about how to use the program.
Unlike mail, the standard UNIX mail user interface program, MH is not a closed system which must be explicitly run, then exited when you wish to return to the shell. You may freely intersperse MH commands with other shell commands, allowing you to read and answer your mail while you have (for example) a compilation running, or search for a file or run programs as needed to find the answer to someone's question before answering their mail.
The structure of MH makes it possible to easily customize the mailer to be more effective and efficient for your use. MH is a more powerful and flexible mailer than the regular UNIX mail program. MH makes it easy to organize and coordinate large amounts of mail. It can be slower for reading individual mail messages, but often can be more powerful when handling large numbers of mail messages.
To get started using MH, put the directory /usr/local/bin/mh in your $PATH. This is best done in one of the files: .profile, .login, or .cshrc in your home directory. (Check the manual entry for the shell you use, in case you don't know how to do this.) Run the inc command. If you've never used MH before, it will create the necessary default files and directories after asking you if you wish it to do so.
The MH system uses the ".mh_profile" file to configure the MH system. You will need to read the man pages for more information about this file. You may also want to look at other peoples files to see examples of MH configurations.
There are some basic commands that allow you to use MH to read mail:
These are the basic commands that are most often used.
show
displays
the current message, or a specific message, which may be
specified by its number, which you pass as an argument to
show. next
and prev
display, respectively,
the message numerically after or before the current
message. In all cases, the message displayed becomes the
current message. If there is no current message, show may
be called with an argument, or next may be used to
advance to the first message.
what now?
prompt. By pressing return you will see all of the
options available to you, l
will "list" your message,
s
will "send" your message, or p
will "push"
your message in to the background. Push is the same as
send but much faster.
All the MH commands may be run with the single argument: `-help', which causes them to print a list of the arguments they may be invoked with.
Commands which take a message number as an argument (scan, show, repl, ...) also take one of the words: first, prev, cur, next, or last to indicate (respectively) the first, previous, current, next, or last message in the current folder (assuming they are defined).
Commands which take a range of message numbers (rmm, scan, show, ...) also take any of the abbreviations:
One of the most useful examples is: scan cur-last
There are many other possibilities such as creating multiple folders for different topics, and automatically refiling messages according to subject, source, destination, or content. For more information please consult the MH manual pages. (man folder, man mh, man refile)
Elm is a menu based way of sending mail. When elm is invoked, a menu of commands is displayed and if you have mail, it will display the subjects of the mail.
There are 3 main ways to use elm:
To invoke elm just type: elm
Once you are in elm, you will see at the bottom of the screen a menu of commands, and if you have mail waiting you will see at the top of the screen, from who the mail is coming from and the subject of the mail. In front of each piece of mail there is a status message and also a number. The status field is composed of three separate character fields, the first of which indicates temporary status:
At the menu you can execute this commands that will enable you to read, send mail, reply to mail, forward mail and other functions.
When sending a message, elm uses vi as the default editor, unless you have altered the editor specified in your .elm/elmrc file or have an editor listed as $EDITOR in your environment. If builtin is specified as your editor, a large set of commands is available while composing your message.
If the file $HOME/.elm/elmheaders exists, elm reads in the contents of the file and adds it to the headers of all outbound mail (useful for adding an Organization: field, Phone: field, etc).
Elm supports automatic configuration by means of an rc file. The file must be named $HOME/.elm/elmrc and can contain any combination of the string, numeric, and boolean variables described below. If the directory $HOME/.elm does not exist, elm asks whether you want to create it or not. If you respond with "yes", elm will create $HOME/.elm.
The following files have special meaning if they exist in your .elm directory:
This chapter talks about six ways to communicate on line with other UNIX system users: mail, messages, news, talk, write, and conferencing programs.
Mail is a way of sending a person a letter and the next time that person logs on again he will be able to read the message. Mail is discussed further in Chapter See section Email.
A way to communicate on line with other users is to use the "messages" facility. Messages are a form of mail where the messages you send go to everyone on the system. The support staff will post urgent messages to msgs. Ongoing discussions and non urgent information should be done in news. Msgs and other news groups are discussed further in section News.
To send a message to everyone on the system, type the following:
mail msgs
Mail will prompt you for everything else you need to enter.
To receive all the messages available, type the following:
msgs
If you are using a machines which does not support messages, then you can read them by reading the articles in the newsgroup msgs. For example,
Many people have the command for receiving messages in their log-in files so that when they log in, they see all existing messages. If you don't see the messages when you log in, but you want to, you can include the command for receiving messages in your login file.
Usenet news is like a very large electronic bulletin board service. It allows users to post electronic "news" articles around the network and to read news items from other users at other sites. More information on news and how to read and post articles is covered in section News.
Talk is a visual communication program which copies lines from your terminal to that of another user. To use talk, type the following:
talk login@fully.qualified.domain.name
Replace login with the user's login, and fully.qualified.domain.name with the user's site.
If you're on a BSD system and you want to find out who is currently logged in and what their logins are, type the following:
moeh Moe Hawthorne s4 24 Fri 15:22 :0.0 griff Griff McClellan se 1d Wed 11:23 sirius.cs.pdx.ed alf Anthony Fiarito co Fri 15:20 tytran The Hitman p0 Sat 03:15 malach.cs.pdx.ed riceman Rich Rice p6 12: Fri 15:05 137.161.6.79 johnj Tail Cat *pa Sat 03:17 pcat144.cs.pdx.e antoy Sergio Antoy q9 2d Thu 09:10 antares.cs.pdx.e
From this list, you can see that Moe is logged in. You can send him a message using talk by typing the following:
talk moeh
If your login is "larr", moeh will get a message at his terminal that looks something like the following:
Message from Talk_Daemon@rigel at 10:07 ... talk: connection requested by larr@cs.pdx.edu.edu talk: respond with: talk larr@cs.pdx.edu
From here, moeh can answer you using talk. When he does, talk splits your screen in two and shows your typing in one half and moeh's in the other half. Both you and moeh will see both sides of the conversation.
When you finish each of your messages, type <0>, for "over", to tell moeh that your message is over. When you're ready to quit, type <0 + 0 >, for "over and out", to tell Moe you're quitting. To exit talk, type ctrl-c.
Note:
If the person you are trying to talk with is logged onto a computer more than once,
you may experience problems connecting. The computer can not tell which tty port you want it to
use. To help the computer out, give the tty after the users name:
talk moeh ttyp3
To find out the tty of another user, use the finger command.
Write allows you to communicate with other users when you are at a hard-copy terminal and the same system. To use write, type the following:
write login Replace login with the login of the user you want to communicate with.
If your login is "larr" and you're working on the rigel system, the person you send the message to receives a message that starts like this:
Message from larr@rigel on ttypf at 10:16 ...e talking to each
That person can reply using write, and you'll be talking to each other. Everything typed at your terminal will be sent to the other user's terminal, and vice versa. End each message in < 0 >, as with talk, and, also like talk, end your write session with < 0 + 0 >. To terminate the conversation, type ctrl-d.
Note:
If the person you are trying to talk with is logged onto a computer more than once,
you may experience problems connecting. The computer can not tell which tty port you want it to
use. To help the computer out, give the tty after the users name:
write moeh ttyp3
One drawback of write as compared to talk is that it's hard to tell when the other person has completed a message and is waiting for your response. A good rule of thumb is to enter two carriage returns after the last line of your message.
If you don't want to be disturbed by other users sending you interactive messages, you can prevent them from sending you messages by using mesg. To use mesg, type the following:
mesg n You can permit messages again by typing the following:
mesg y
There are a couple of different programs that allow you to talk interactively with more than one person at different sites. These programs are unsuported and not installed on all machines.
The basic idea for the programsis to have a large amount of people using the program from different places at the same time, sort of like a party line on the phone. You can join different "channels" or groups with different topics and talk to all the people on the channel, or you can send private messages to a certain user.
IRC stands for Internet Relay Chat. To start irc type irc2 at the prompt:
irc
This will put you in the irc window with the line on the bottom used for giving commands and the rest of the window for watching what else is happening. These sections are divided by a highlighted line that says your nickname, the program name (IRCII) and /HELP for help. When you type /HELP you get a list of topics that you can get help for. You can type /HELP BASICS to get the following introduction to irc.
Irc is a multi-user, multi-channel chatting network. It allows people all over the Internet to talk to one another in real-time. Each irc user has a nickname they use. All communication with another user is either by nickname or by the channel that they or you are on. All IRCII commands begin with a / character. Anything that does not begin with a / is assumed to be a message that is sent to everyone on your channel. Here is a list of basic commands to help you get started:
These commands should get you started on irc. Use the /HELP command to find out more about things on irc, or ask question of people... most would be happy to help you out. You can also type man irc to read the man page. Another good source of information about irc is to read the newsgroup alt.irc.
Remember, when you first start irc, it puts you into channel 0 (or *). Since this really isn't a channel, you need to join another channel in order to talk to other people on that channel. Once you have joined a channel, anything you type and then hit return afterwards, everyone on that channel will see. IRC uses your login name as a default nickname. To change your nickname you would type /NICK your new nickname.
Introduction
Two editors are used on the Computer Science Department's UNIX systems: vi and emacs.
The next two sections explain vi and emacs. Each section contains the following: a general description, how to learn it, how to get into it, and some of its commands.
Vi is a visually oriented text editor that's based on ex, a line editor that's available on most UNIX systems.
You can learn vi by doing the following:
To use vi, type the following command:
vi file
If the file you designate exists, it will be opened, and the contents will be displayed. If the file does not exit already, vi will open a file with the specified name. Vi has two modes: command and insert. When you start vi, you're in command mode. In command mode, vi accepts commands like the ones listed later in this section (commands to move, delete, save, etc.). In insert mode, vi accepts everything you type as text.
If you're in command mode, you can enter insert mode by typing a command like i, which inserts text starting at the cursor (there are others -- see the list of commands). If you're in insert mode, you can enter command mode by pressing the escape key.
Emacs is an advanced, self-documenting, customizable, extensible real-time display editor. Emacs was written by Richard Stallman of the Free Software Foundation. Emacs is mostly written in Lisp, with some C for efficiency.
Emacs is WYSIWYG (what you see is what you get), updated frequently, has features like text filling, auto-indent, viewing 2+ files, deals with characters, words, lines, paragraphs, sentences, pages. The user can change the definitions, rearrange the command set, and create new commands (programs in Lisp) online (don't need to create a new version).
Welcome to Emacs. Learning Emacs may seem a daunting task, but spending a few minutes learning Emacs, can save you many more in the future. Emacs is an extremely powerful editor and many of tasks you now do from the command line and using different applications can be done from inside of Emacs.
The section contains a brief tutorial on some of the basic operations of Emacs, so you can get started quickly and learn the more powerful features later.
To start Emacs type `emacs' and an optional file you wish to edit then press return. That's it!
If you didn't specify a file when you started Emacs you can open one after you enter Emacs by typing C-x C-f. This means hold down the control key and then press the x and f keys and release the control key. You will be prompted for a file name at the bottom of your Emacs screen. Enter the file name you wish to edit and press return.
There are three different ways to move around in your file: Control keys, the mouse and, if they are enabled, the arrows keys on your keyboard. Below are the control keys, with which you can move around in your file. Any other keys you press will be inserted as text in your file.
C-f forward-char C-b backward-char C-n next-line C-p previous-line C-a beginning-of-line C-k kill-line C-e end-of-line C-d delete-char C-g keyboard-quit C-h help-command C-l recenter C-o open-line C-r isearch-backward C-s isearch-forward C-t transpose-chars C-v scroll-up C-@ set-mark-command C-w kill-region C-y yank C-z iconify-frame C-_ undo
To save your file press C-x C-s
To exit Emacs press C-x C-c
If you get stuck by hitting the wrong key combinations you can press C-g to abort. This will terminated almost any command. You should read the section on getting help before you get started.
Command completion is a usefull time saving feature of Emacs and can save you many keystokes and works in most contexts. One usefull example is: when opening a file you don't have to enter the whole name, just type the first letter or first unique letters and then press the tab key. Emacs will fill in the rest for you. If there is more than one file with the same first characters, pressing the tab key again will open a buffer window with a list of the file names which have those first characters.
If you are using Emacs19, read the section on Emacs19 first. Many of the commands you do by entering keystrokes can be done using menus.
When you see M- in the documentaion it means press the ESC key first. On some systems the ALT key has the same effect.
To execute a command in Emacs use M-x and then the command name.
When you edit a file in Emacs, it is stored and edited in a buffer and when you save your file you are actually saving a buffer. Buffers can not only contain files they can also be used for a wide variety of purposes. Among these is storing and displaying the information generated by help commands and utility lisp programs such as mail handlers or gnus, the Emacs news reader.
These are the most used buffer commands.
To list all the buffers use C-x C-b this is bound to the list-buffers command.
To kill a buffer use C-x k this is bound to the kill-buffer command.
Buffers in Emacs are displayed in windows. When you first start Emacs you see only one window, you can display more than one window by dividing the display either vertically or horizontally.
Use C-x 2 to split a window vertically or use C-x 5 to split a window horizontally.
Delete a window with C-x 0 and move to another window with C-x o.
An Emacs reference card is available in the tutors room. Complete documentation is available in the info system under Emacs. Printed version of the same documentation is also avialable.
One of the big advantages of Emacs over other editors is the extensive availability of on-line help. To acess on-line help use ESC-? or C-h depending on which is enabled in your system. Here is a list of the help functions and a brief explanation of them.
Emacs19 is the X-based version of Emacs and is mouse-sensitive. Many new feature have been added. Read Emacs News in the help menu for a list of these.
Menus have been added and can be accessed by the menu bar or by holding the control key and clicking a mouse button. These menus can also be customized.
A scroll bar is on the side of the frame and by clicking on it with the mouse you can move around your buffer.
Multiple frames can be added with new frame.
The mouse can be dragged to mark a region and with the edit menu you can cut and paste like many commercial wordprocessors. You can also cut and paste between Emacs and the rest of your X terminal screen.
Emacs19 is still unsupported software at PSU and is located in the /usr/local/uns/bin path. Some parts of the .emacs initialization file don't port to emacs19.
(display-time)
(setq-default version-control t)
(setq-default auto-save-interval 50)
* display-time displays the time, system load factor and a flag to indicate unread mail on the mode line (in addition to the other stuff).
* version-control set to true allows for versioning: if you edit the file prog1.c, then you will end up with a previous version, prog1.c. and the current file.
* auto-save-interval saves your file after specified number of keystrokes. (Causes short delays, but I value my work.....)
After typing in your login and password, XDM checks your home directory for a .xsession file. If you have a .xsession file, it is executed. If you do not have a .xsession file, then the file /usr/local/X11R5/lib/X11/xdm/.xsession is executed. In order to change the Window Manager that is started, or to modify the other programs that are started when you log in, you must have a .xsession file in your home directory.
The CS department supports one Window Manager: twm
.
If you want to customize your X environment, you may copy the default startup files and modify them accordingly. Make sure you know what you are doing before modifying the default setup, because it is very easy to make a mistake that will prevent you from logging in. When in doubt, ask the tutor for assistance.
The .xsession files support two Xresources files. The system keeps a Xresources file in /usr/local/X11R5/lib/X11/Xresources. You may have your own customized Xresources file in your home directory.
Warning:
If you modify your .xsession file, make sure that you do not remove
the line that loads the system Xresources; things will stop working
if you do not load the system Xresources.
The system default .twmrc file may be found in /usr/local/X11R5/lib/X11/twm. To customize the action and feel of TWM, you must first copy the .twmrc file to your home directory. To do this, type the following: cp /usr/local/X11R5/lib/X11/twm/system.twmrc $HOME/.twmrc
The features included in the standard .twmrc are described here.
To see the pop-up menus, press one of the mouse buttons while the mouse cursor is located in the root (grey background) window.
The first menu is reached by pressing the left mouse button, while the mouse cursor is in the root window. It is labeled Window Options. This menu contains things you can do, such as Refresh the screen, Focus on a window, Move or Destroy a Window, Show or Hide the Icon Manager Window(usually located in the upper right corner of your screen), Reread the .twmrc file (useful if you've made some changes and you want to see the results without logging out and back in), and Exit TWM, the Tom's Window Manager program.
The second pop-up menu, reached by pressing the center mouse button while the cursor is located in the root window, is the Hosts menu. With this menu you can open a window on a particular computer host, such as Sirius, Jove, Csqr, Odin, or the PSU library, if you have an account on that machine. You will be given a login prompt for typing in your account name and password.
The third menu, reached with the right mouse button, is the Applications menu, giving you the option of opening certain applications, such as a calculator, a man page reader, a mail reader (elm), etc. Not all of these work on every machine. Xman is one that you may want to take notice of. It opens a window in which you can look at man pages.
The set of menus described in the previous section pop-up when the mouse cursor is on the root window. There is another set of menus that pop-up when the mouse cursor is on a window and the control key is pressed while a mouse button is being pressed.
Pressing the left mouse button while the cursor is within a window and you are also pressing the control key gives you a menu of Main Options, such as redrawing a window, or sending a kill signal to destroy the window.
Using the middle mouse button with the control key gives you some options for controlling the window you are currently in, such as changing to reverse video, or enabling the visual bell (the window will flash instead of beep when you make an error).
If you press the right mouse button while pressing the control key, you will be given the option of changing the size of the font in the window you are currently in, making it smaller or larger.
If you have several windows open and want to copy some text from one window to the other you can use the cut and paste feature of X.
First select the text in one window using the first mouse button (left). Then go to the window you want to paste that text to and press the second mouse button (center). The text will appear in the window just as if you had typed it yourself.
Below is a chart of what happens when the mouse keys are pressed. Different things happen depending on where the mouse is and what keys are pressed at the time.
Text processors are similar to compilers, but instead of preparing a program for execution, they prepare a text file for printing. For example, this manual was created using a text processor. The authors created a text file and put in it both the manual's text and commands to tell the text processor how to format the text. Because of the commands they included, the headings are in bold-face type, the examples are indented, and so on.
There are two major text processors available: troff and TeX. LaTeX is a macro package for TeX and gets used more than Plain TeX at PSU (and many other places), so this section will go over LaTeX and TeX format text to be printed on a laser printer, although there are programs to give a "tty" approximation of the output. There are X-window based preview packages available for troff and TeX. Using them will save you time and paper.
LaTeX (pronounced lah-tech) processes files so they look typeset and can be printed on a laser printer. LaTeX is widely used on college campuses for writing technical reports, theses, and sometimes class assignments, but can be used for much more.
There are several facilities available to you for helping with LaTeX. The first place that you should probably look is in a book called LaTeX, A Document Preparation System (which will be referred to as the LaTeX Manual for the rest of this section) written by Leslie Lamport. The author of the book is the actual programmer of the macros that are used by LaTeX to do it's processing. The book can be ordered through most bookstores.
The second place you can find help with is a newsgroup that has been set up to field questions concerning LaTeX. If you are stuck with a problem that the LaTeX Manual cannot answer, you can post a message on `psu.TeX'.
For general discussion of LaTeX you can read the newsgroup comp.text.tex.
To learn LaTeX, you can read this chapter and/or read the LaTeX Manual. This section provides fundamental information to get you started using LaTeX and acquaint you with LaTeX's capabilities. The LaTeX Manual does an excellent job at giving more detailed help and more thorough examples. The LaTeX Manual is the comprehensive document describing LaTeX; it provides everything from basic information to specifics on setting up your own document formats.
The LaTeX Manual often refers to the TeX book. This is the book that describes TeX. This comprehensive book, written by Donald Knuth (as was TeX itself), is available Library.
To prepare a file to run through LaTeX, you must include commands that tell LaTeX what to do with the text in the file. This section explains the basic LaTeX commands and some of the effects you can produce using LaTeX.
LaTeX understands three basic document styles:
report
, article
, and letter
.
Many add commands to LaTeX, but some
are whole document-changing styles.
The major difference between the report and article styles is that
reports can have chapters and sections but articles can only have
sections. The letter style, of course, formats letters.
The following is an example of the most basic LaTeX commands:
\documentstyle{report} \begin{document} Mares eat oats and does eat oats and little lambs eat ivy. \end{document}
These commands tell LaTeX what kind of document the file is, where the document starts, and where the document ends. Every text file that is to go through LaTeX must contain these commands.
The only variable parts of this example are the actual document style and the text inside the document.
The text inside the document can be formatted in many ways. To produce a simple document, you might want to know about the commands to produce the following elements:
To produce a chapter title (which starts a new page) in the report
style, include the following command after the
\begin{document}
command:
\chapter{name}
To produce a section heading in either the report or article styles, include the following command:
\section{name}
In both situations, when LaTeX finds the command, it formats name according to what the document style dictates, affecting the type style and size of name and the spacing around it.
Another thing LaTeX does when it finds the command is put the word "Chapter" or "Section" and a number in front of the chapter title or section heading. To prevent LaTeX from numbering the chapters and sections, include an asterisk (*) between the command and the curly brackets ({}) that enclose the name, as in the following example:
\section*{A Lovely Day}
The chapter titles and section names in this manual are examples of what the report style produces without an asterisk. The LaTeX Manual explains how to have additional levels of section headings in the report and article styles.
LaTeX has the ability to handle footnotes in a wide variety of ways. To produce a footnote, you need to place the following command after the text you wish to footnote:
\footnote{ text }
where text is the text that will be the footnote. There are several different ways to format you footnote. You can number the footnotes or just use symbols. See the LaTeX Manual for more information.
LaTeX has several styles and sizes of type available. The LaTeX Manual provides a complete list. To produce italicized text, type the following:
{\it text}
Replace text with the text you want to be italicized. For example, the command {\it \LaTeX\ Manual} produces the italicized manual title that appears throughout this section.
To produce bold-faced text, type the following:
{\bf text}
Replace text with the text you want to be bold faced. For example, the {\bf This is bold face.} command produces the following text:
The following list shows the characters latex has special meanings for (in the left column) and the command you must put in your file to get latex to produce each character (in the right column):
In addition to the effects described above, there are several other effects you can produce using LaTeX commands. These include, among others, lists, pictures, tables, equations, tables of contents, and indices. This manual was created using LaTeX, so you can use LaTeX to produce anything you see in this manual. Refer to the LaTeX Manual to learn how.
The name of a file to be run through LaTeX must end with .tex. To run a file through LaTeX, type the following command:
latex file
Replace file with the name of the file to be run through LaTeX. For example, to run the file examples.tex through LaTeX, I could type the following command:
latex examples.tex
LaTeX responds by working its way through the file and reporting its progress as it goes. This "report" goes to both the terminal screen and a file called file.log, where file is the name of the file you ran through LaTeX (without the .tex suffix).
If LaTeX finds errors, it reports them as it finds them. If LaTeX generates error messages you don't understand, refer to the LaTeX Manual for explanations.
If LaTeX finds no errors, it generates a file called file.dvi, where file is the name of the file you ran through LaTeX (without the .tex suffix). The .dvi suffix is short for device independent. A dvi file can translated into the many different languages that printers know about. To print your LaTeX documents, see Section See section Printing.
This section gives a couple of examples on how to prepare files to run through LaTeX, how to run them through LaTeX, and how LaTeX responds.
The following are the contents of a file called `example.tex', which contains the commands that are necessary to run it through LaTeX. Don't let some of the formatting scare you off. Once you get the hang of LaTeX you will be able to produce great looking documents.
\documentstyle{report} \parskip= 10pt plus2pt minus2pt \setlength{\parindent}{0in} \begin{document} \chapter{Example chapter} \LaTeX\ is a very powerful system for typesetting all of your documents. It does such things as tables, pictures, indices, tables of contents, bibliographies, footnotes\footnote{See how easy footnotes are.}, and much much more. Here is what a table can look like: \begin{center} \begin{tabular}{|c|c|} \hline {\it heading} & {\it heading} \\ \hline \hline item & item \\ \hline item & item \\ \hline \end{tabular} \end{center} The math abilities of \LaTeX\ are also {\em very} powerful. For example: \begin{displaymath} \sum_{i=1}^{n} x_{i} = \int_{0}^{1} f \end{displaymath}
The following shows the command that runs example.tex through LaTeX:
latex example.tex
The following shows how LaTeX responds to this command:
This is TeX, C Version 3.14t3 (example.tex LaTeX Version 2.09 <14 January 1991> (/usr/local/lib/tex/inputs/report.sty Document Style `report' <13 Nov 89>. (/usr/local/lib/tex/inputs/rep10.sty) (/usr/local/lib/tex/inputs/titlepage.sty)) (example.aux) Chapter 1. [1] (example.aux) Output written on example.dvi (1 page, 1696 bytes). Transcript written on example.log.
The next page shows what the file example.dvi looks like when it's printed on a laser printer (note the new page caused by the \chapter command).
Troff formats text for sending to a phototypesetter or printing on a laser printer.
This section is focused towards the -ms macros. A more complete reference, which is being written, is available in it's current state in See section `Top' in The GNU Troff Manual.
To learn troff, you should first read this section. It provides a lot of information to help you understand Troff because the manual that describes troff is pretty dense and not very learner-oriented. After reading this section, you can refer to the Unix User's Supplementary Documents (USD) chapters 20 through 25 for additional information.
There are many different types of troff: nroff, troff, ditroff, psroff, groff, and others. They all use the same commands but print to different types of printers or have added features. Nroff is used when you want to print to a low resolution device like a lineprinter. Groff is the GNU implementation of troff, which is used at PSU, and is, thus, used in examples.
To prepare a file to run through troff, you must include commands that tell troff what to do with the text in the file. This section explains the basic troff commands and some of the effects you can produce using troff.
The most important thing to remember about all troff commands is that they must begin at the left margin. If troff finds a command some place other than the left margin, it thinks the command is normal text and doesn't execute it as a command.
Troff commands allow you to do the following tasks:
The following sections explain how to do these tasks. The last of these sections summarizes these troff commands.
Troff also allows you to define constants and macros and use conditionals and diversions. To learn how to do these tasks, refer to the Unix User's Supplementary Documents (USD) chapters 20 through 25.
To set a margin for the top of a page, include the following in your file:
.nr HM topmargin
Replace topmargin with the size you want the margin to be. For example, to set the top margin to 1.5 inches, include the following command in your file:
.nr HM 1.5i
To set a margin for the bottom of a page, use the same command, but replace `HM' (header margin) with `FM' (footer margin).
Troff provides three basic type styles: roman, italic, and bold. Troff allows for different type fonts, but they must be mounted on the printer. For further information, contact the system administrator or refer to the Unix User's Supplementary Documents (USD) chapters 20 through 25 and the appropriate printer manuals.
To set a type style, include the following command in your file just before the text you want in that style:
.ft style
Replace style with the type style you want: R for roman, I for italic, or B for bold. For example, if you wanted to italicize a book title in the middle of some roman text, your file would look something like the following:
The book .ft I Handbook for Technical Writers .ft R is a good reference book for anyone writing about a technical subject.
This file italicizes the book title Handbook for Technical Writers and then returns to roman type for the rest of the text.
Troff also allows for different type sizes: 6, 7, 8, 9, 10, 11, 12, 14, 18, 20, 22, 24, 28, and 36 point. Text is usually around 10 or 11 points. Headings are often around 14 or 18 points. Newspaper headlines often measure about 36 points.
To set a type size, include the following command in your file:
.ps size
Replace size with the type size you want. For example, if you wanted to write a paper and give it a heading that was larger than the text type, you might create a file that looks like this:
.ps 18 .ft B Going Skiing .ft R .ps 11 Going skiing is really fun. Whenever I have a chance, I go skiing. I am planning to go during spring break.
The commands in this file create a heading that is set in 18-point-high bold type, and then they switch to 11-point-high roman type for the text. These styles and sizes are about equivalent to the chapter titles and text in this manual.
Troff allows you to set the spacing between lines in inches or in terms of single- and double-spacing on a typewriter. To set the amount of space between lines, include the following in your file:
`.sp spacing'
Replace spacing with the amount of spacing you want. For example, to set the space between lines to 1.5 inches, include the following:
`.sp 1.5i'
To set the space between lines to be like a typewriter's double spacing, include the following:
`.sp 2'
As with other troff commands, once you set the line spacing it stays the way you set it until you change it to something else.
The default line length in troff is 6.5 inches. Troff allows you to change the line length by including the following in your file:
.ll length
Replace length with the line length you want. For example, to set the line length to 5 inches, you'd include the following command in your file:
.ll 5i
Troff allows you to set tabs by using the .ta command as follows:
.ta tab1 tab2
The desired tabs replace tab1 and tab2. For example, to set tabs at one-half inch, one inch, and four inches, you'd include the following command in your file:
`.ta 0.5i 1i 4i'
Troff provides two ways to indent text. The first is for indenting the first line of paragraphs, and the second is for indenting examples, lists, and similar information.
To indent the first line of paragraphs, include the following command in your file immediately before each paragraph that is to be indented:
`.PP'
A file whose paragraph's first lines were to be indented might look like this:
.PP Once upon a time, a long time ago, there was a little girl named Goldilocks. She lived near a big forest that was full of wonderful trails. .PP One day, Goldilocks went for a very long walk on one of the trails. Pretty soon, she came upon a lovely house in a clearing.
The first line of each paragraph, starting with "Once" and "One" will be indented.
To indent examples, lists, etc., include the following command in your file directly before the text that is to be indented:
.in indentation
Replace indentation with the amount you want the left margin to be indented. For example, if you had an example you wanted to indent, like the Goldilocks example, your file would look something like this:
.in 0.5i .PP Once upon a time, a long time ago, there was a little girl named Goldilocks. She lived near a big forest that was full of wonderful trails. .PP One day, Goldilocks went for a very long walk on one of the trails. Pretty soon, she came upon a lovely house in a clearing.
The left margin in this example would stay indented one-half inch until you included a second indent command to set it back to zero.
Troff allows you to make paragraphs that have a label in the left margin by including only one command, .IP. To use .IP, include it in your file as follows:
.IP label
Replace label with the label that is to go in the margin. For example, if you wanted to create a paragraph and give it a label called "Weather," your file would look like this:
.IP Weather This is a nice day. We could have been outside having a fun time. But probably by the time we get outside it will be raining.
This file produces the following output:
The following list shows the troff commands discussed in this chapter (in the left column) and what each command does (in the right column).
To run a file through troff and send its output to a file, type the following command:
groff -ms inputfile > troffoutputfile
Replace inputfile with the name of the file to be run through troff. Replace troffoutputfile with the name of the new file you want to receive troff's output.
For example, to run a file called ch9 through troff and send its output to a file called ch9.out, you would type the following command:
groff -ms ch9 > ch9.out
The following are the contents of a file called graduate, which contains the commands that cause troff to format the output:
.nr HM 2i .ps 24 .ft B How Happy I Am To Be Graduating (example) .ft R .ps 11 .sp 0.5i This report describes how happy I am to be graduating this term. .sp 0.25i .ft B Sing .sp 0.25i .ft R I'm so happy, I could .ft I sing! .sp 0.25i .ft B Dance .sp 0.25i .ft R I'm so happy, I could .ft I dance! .sp 0.25i .ft B Smile .sp 0.25i .ft R I'm so happy, I could .ft I SMILE ALL THE TIME ! .nr FM 2.5i
Texinfo is the GNU document formatting system. This document was produced using Texinfo. For further information See section `Top' in The Texinfo Manual.
This chapter explains how to print files, and how to get your printouts. It will explain how to print text files, DVI files (produced by TeX, LaTeX, or groff), PostScript files, and images (gif, rle, pbm). Do not send binary files to the printers! The printers cannot print binary files, and get very confused when sent on
On the CS systems we use the Berkeley printer spooling package. There is an alternate package used on SysV machines, it is not in use, and, thus, will not be discussed.
By default, they all operate on the default printer (`lp'), a
different printer can be used by using the `-Pprinter-name'
argument. Alternately, the environment variable PRINTER
may be
set to your preferred printer.
The command for printing a file to a printer is lpr. To print a file called `foo' to the default printer (lp1 on most machines):
lpr foo
If you want to print the file to a different printer, say `lw3', use
lpr -Plw3 foo
The general syntax is lpr -Pprinter file where printer is one of the valid printers on our machines. A list of printers is shown in See section Printers in the CS Department.
If you normally print to a different printer than the default, you can take advantage of the environment variable PRINTER. For instance, if you normally print to the lw3 printer, you can type the following line:
setenv PRINTER lw3
and from now until you log out, your default printer will be lw3.
Therefore, when you use lpr
without the -P option, it will
send the file to the `lw3' printer. Of course, you can still use
-Pprinter to make it go to a different printer.
If you put the above line in your .cshrc, it will set your default printer every time you log in, so you won't have to type it each time. lpr, lpq, and lprm all use the PRINTER variable.
The command for examining the printer queue (or spool) is lpq
.
To display the queue of the default printer type lpq and you will
see something like this:
lp is ready and printing Rank Owner Job Files Total Size active trent 971 standard input 89471 bytes 1st alsam 771 standard input 16851 bytes 2nd trent 973 standard input 35393 bytes 3rd hsin 466 standard input 1233 bytes 4th trent 975 standard input 38179 bytes 5th trent 978 standard input 11381 bytes 6th lynnette 461 Newsout 2426 bytes
For a different printer, the -P option, as in lpr
, can
be used. For instance, to see what jobs are waiting for the `lw3'
printer, use lpq -Plw3.
The command for removing a job from the printer spool is lprm
.
If your job is currently printing and you wish to stop it, you can use
the lprm with no arguments.
NOTE: removing the currently printing job can mess up some printers, notify the Tutors or Sysgroup if you need to do this.
To remove a specific job,
you will need to use lpq
to get the job number, and then
use the job number as an argument to lprm. Assuming the queue
shown in section lpq, the following command would remove `lynnette''s
print job.
lprm 461
The argument `-' will remove all jobs that you own.
As with lpr
and lpq
you can specify a printer with the
`-P' option.
All line printers have names starting with `lp'. In most situations, to print an ASCII file, the following command is used:
lpr -Pprinter filename
Files with backspace sequences (i.e. typescripts) should not be sent
directly to a line printer. To eliminate these sequences, filter your
file through col
:
cat file | col -b | lpr
If tabs do not appear right on the printer use expand
to turn them into spaces.
cat file | expand | lpr
To print text files to a PostScript printer, the file must first be converted to PostScript. Most of our spoolers will automatically convert text sent to them to PostScript, but it is not a good idea to count on this feature. We have two different programs to convert text to PostScript, each with their advantages and disadvantages, and different options. When run without options, all of them will produce acceptable output, but you may wish to use the options to get output which is more suitable to you.
enscript
mpage
Examples of use:
enscript -2rG -Plw2 foo mpage -8 -Plw3 baz
DVI files are generated by the TeX, LaTeX, and groff
programs. DVI stands for device independent, which means one must
convert a DVI file to whatever format the output device will use.
There is no program which can produce acceptable ASCII output from
a DVI file. The program dvitty
attempts to do this, but falls
quite short. We do not support this program.
The dvips
program is the DVI to PostScript program we are
supporting on all our machines. dvips
supports a multitude of
options, and is highly configurable. For a complete overview, see the
dvips
manual.
In these examples, we will assume the file `foo.dvi' is to be printed.
Normally, you use dvips
to convert the DVI file into PostScript and
then lpr
the result:
dvips -o foo.ps foo.dvi lpr -Plw3 foo.ps
To send a PostScript file to a line printer, you can use lpr
. The
text of the PostScript code will be printed out. This is usually not what
you want, as PostScript source code tends to be quite long (possibly
hundreds of pages).
To send a PostScript file to a PostScript printer, you can use lpr in the standard fashion. This printer should be a PostScript printer, and the file should begin with the characters `%!'. To print file.ps, use:
lpr file.ps
To print image files, you must convert them into PostScript and then send them to the printer. The only packages which are capable of this are unsupported.
This section applies primarily to printers which have quotas installed (See section Printers in the CS Department, for more info). On any printer with quotas, copies must be either paid for or pre-authorized.
The policy is as follows:
The procedure for getting/buying copies on a quota'ed printer is as follows:
There are two programs for manipulating printer quotas: lwquot
,
and lwaddquot
. These programs are rudimentary, and
will be replaced with a more elaborate system.
The lwquot
command will display a user's current allowance on a
printer. Notice that it prints the totals; subtract the two numbers to
find out how many more copies the user has. If no username is given,
`$USER' is used.
% lwquot glatz 75 pages allowed 15 pages used
The CS Department's new HPIIIsi, and EE's existing HPIIId, laser printer have two features which can be accessed from the various printing programs.
The first feature is duplex (or double-sided) printing. A component of this is a feature called tumbling, which involves rotating the second side 180 degrees. This is used when for output which is rotated (landscape mode). `lw2' is set to print duplex by default.
The second feature is the ability to select paper trays. By default, the printer will use the upper paper tray, the lower tray may contain special paper (i.e. letterhead). We do not (yet) have an envelope feeder tray.
All of the options may be selected by post-processing your postscript
code with the program psmod
. Read the man page for full
information.
What follows are examples of how to use psmod
with most
applications. Only the necessary options are shown.
enscript -p- file | psmod | lpr -Pprinter mpage -P file | psmod | lpr -Pprinter groff file | psmod | lpr -Pprinter psroff -t file | psmod | lpr -Pprinter dvips -f file.dvi | psmod | lpr -Pprinter psmod file.ps | lpr -Pprinter
If you want to manually add these options to a PostScript file, You can
use psmod
to tell you what to add to the file. The following
command will print out the necessary PostScript code.
echo %! | psmod
With groff
and TeX, these printer options may be selected
within your document. This may be useful if you want to change options
on the fly.
In groff
the local macro package `-mhp' supplies macros for
changing these printer options. To select duplex mode use the
`.duplex-mode' macro. An argument of `tumble' can be given to
to that macro turn on tumbling. From the command line, the argument of
`-dduplex=1' will enable duplex printing, and `-dtumble=1'
will enable tumbling. To select a certain paper tray use the
`.papertray' macro, with an argument of `lower', `upper'
or `envelope'. From the command line, the argument of
`-dtray=tray-name' will select the corresponding paper tray.
For TeX, there is a local set of macros in `/usr/local/lib/tex/inputs/local/hp.sty' which can activate the printers special features.
The most up-to-date listing of printers is available in `/etc/printcap', this listing is correct as of Sept-93
lpcs (lp on CS machines)
lpee
lpmsb
lw1:
lw2
lw3
lw4
lw5
lw6
csappletalk
eeappletalk
Commonly people think of computer resources as unlimited, especially in the case of powerful multi-user systems. But in fact, all computer resources are limited. UNIX does a good job of sharing resources among multiple users under a changing work load, but you can help get the most out of the physical UNIX machines by using these resources wisely.
This chapter explains several ways that you can use UNIX resources efficiently.
The publications listed in section Books, provide further information on the techniques described in this chapter. They also provide additional techniques for using UNIX efficiently.
Many shells are available on the Computer Science Department's
UNIX systems, most of them derive from either the Bourne shell
(sh
) or the C shell (csh
). Each of these shells has
spawned other shells that have improved features. The Bourne Shell has
spawned the Korn Shell (ksh
). The C shell has spawned
tcsh
. The Born Again Shell (bash
) is an alternative
replacement for sh
which implements features of ksh
and
csh
plus others.
The books listed in
section Books and the man pages explained in section Man Command
explain these shells in detail. Documentation for bash
is
available in See section `Top' in Bash Manual.
When using UNIX systems around PSU, you are typically using one of the following UNIX varieties:
Each of these versions of UNIX evolved from the original UNIX developed by AT&T in the mid-seventies.
After creating the original UNIX, AT&T developed two notable experimental varieties in the late seventies: Version 6 in 1975, and Version 7 in 1978. From these experimental varieties, two major stems developed in the early eighties: Berkeley and System III.
The publications listed in Section See section Books provide more information on UNIX varieties and their history.
You need to know is which UNIX variety is on the computer you're using. With this knowledge, you can tell which UNIX utilities are available to you and which are not.
Each time you log in, your log-in files are executed. These files
establish your particular computing environment for that session, and
may be modified to suit your personal needs. The login files will,
for example, assign certain functions to specific keys -- like the
erase function is assigned to the BS (backspace) key -- or
determine where commands will be found on the system. They determine
what abbreviations you can use and what characteristics your terminal
has. These files are called `.login' and `.cshrc' if your
login shell is csh
, and `.profile' if your login shell is
sh
. Each of the different shells might have specific
initialization files. You should check the man pages on the specific
shell to get the specific information.
You can find your login shell by saying: finger login_name
You can set your own abbreviations and terminal characteristics by
using the alias
and stty
commands. You put these
commands in your log-in files using an editor. Once you've modified
your log-in files, your settings will be set in place every time you
log in. Be careful--mistakes can make it possible that you can't
login again.
The default shell that the system comes with here at PSU is C-shell. To change your default shell you need to run the program chsh. To learn how to use the chsh program refer to the man page of chsh. To get help using the man command, section Man Command.
You can set abbreviations for use in csh
using the alias
command. To use the alias
command, include the following
in your `.cshrc' file:
alias abbrev fullcommand
For example, suppose you find yourself frequently typing ls -Fas.
You can set up an alias dir
for this command by including the
following in your `.cshrc' file:
alias dir "ls -Fas"
Adding this command to your `.cshrc' file causes the dir
command to exist for you every time you log in. Thereafter,
whenever you type dir, UNIX will act exactly as though you had
typed ls -Fas.
You can set terminal characteristics using the stty
command.
The stty
command is complicated, with many options, but once
you get it to set the terminal characteristics you like, you can put
it in your `.login' file and you'll never see it again. You can
see all of your settings by saying: stty everything or on System
V machines stty -a.
For example, many UNIX systems use the backspace key to
erase characters. If you're used to Digital Equipment
Corporation (DEC) systems, you're probably accustomed
to using the delete key for this purpose. The stty
command
has an option called dec, shown below, that causes the delete
key to erase characters.
stty dec
Including this command in your `.login' file makes your terminal act like it's on a DEC system every time you log in. To learn about other stty command options, refer to the man pages described in section Man Command, or the publications listed in section Books.
If you are using an X window system and you change the size of the window, the window will need to be resized. You can do this by saying: set noglob; eval `resize`
The Computer Science Department recommends that you change your password often, at least once a quarter. You should become familiar with the procedure described in this section. The following guidelines should be followed when selecting a password. The new password must be at least six characters long and should contain a random number. Avoid joes (i.e. any variation of your own name) and any other easy to guess words. WARNING: if you do not use a secure password (i.e. we in the CS Department are able to crack it) you may lose your machine privileges. Security of our systems depends on your password, and we are very security conscious. To change your password, issue the following command:
passwd
The system responds by prompting you for your current password to verify that you are authorized to make such a change. Then it asks you for the new password. On most systems, your password will be checked to make sure it is not easy to guess, if it is, it will ask you for a better password. After you enter the new password, it prompts you for it again. If the two inputs are identical, your password is changed. If they differ (if you made a typing mistake, for example) your password is not changed. This prevents you from mis-typing a password that you then could not use.
This section explains two ways to decrease the amount of time you spend at a terminal. The first one, re-executing commands, allows you to find out which commands you've entered since you logged in and to re-execute any one of them. The second one, completing filenames, allows you to type a portion of a file name and have UNIX return all the file names that contain that portion.
The UNIX C shell provides a mechanism that allows you to recall
previous commands and re-execute them. To see what commands UNIX
has saved during your login, use the history
command.
UNIX responds with a display similar to the following:
1 mail 2 finger 3 cd assign1 4 ls -F 5 more try1.c 6 grep bitsearch try1.c 7 cd 8 ls *.h 9 cp myheader.h assign1 10 pwd 11 cd assign1 12 vi try1.c 13 cc -o try1 try1.c 14 lint try1.c
Knowing which commands you've entered, you can re-execute any of them using one of several methods. You can re-execute the most recent command, you can re-execute a command by specifying its number or a fragment of its name, or you can add to a command and then re-execute it.
There are also more sophisticated methods for re-executing pieces of
previous commands. They are described in section The C shell and in the
csh
man page. In general, program development time can be
decreased simply by re-executing compile and edit commands.
To re-execute the last command you entered, type !!. The following example shows this command and how UNIX responds:
rigel% !! lint try1.c output from lint
To re-execute a command by specifying its number,
type !number where number is the
command number. For example (look at the history
example
above)
rigel% !8 ls *.h
To re-execute a command by specifying its name or a fragment of its name, type !name where name is the name or name fragment. For instance:
rigel% !more more try1.c
To add to a command and then re-execute it, use one of the preceding methods but don't type a carriage return, and then, on the same command line, type what you want to add to the command. The following example shows the lint command being re-executed with "| less" added to it:
rigel% !lint | less lint try1.c | less
For even faster program development, combine history with job control. See section Controlling Jobs, for more info.
UNIX provides another way to minimize key strokes called
command completion. It allows you to type the first letter or
letters of a file name followed by the esc key and have UNIX
return the only file name that matches the letter or letters you
typed. This feature is supported by some csh
's, bash
,
tcsh
, and ksh
. If more than one file name matches, the
shell will wait for more letters. Command completion also allows you
to type the first letter or letters of a file name and then type
ctrl-d (for csh
's), causing UNIX to return all the file
names that match the letters.
To use it on BSD systems, your `.cshrc' login file must include the command that makes the esc key and ctrl-d work. To include this command if it's not already in your `.cshrc' file, do the following. Invoke an editor and bring up your `.cshrc' file. Move to the end of the file, and insert the following line:
set filec
Then save the file and leave the editor. File completion is not
available under DYNIX unless you use the bash
shell.
The man pages described in section Man Command have a page called
csh
that contains additional information on completing
filenames. To find this information, call up that man page and then
search for the pattern `complete'.
One job-control tool lets you suspend a program that is taking a long time to execute. When you suspend a program, it stops running and frees your terminal for other work. Another job control tool allows you to continue running the program in the background, causing the program to continue running detached from your terminal. Using a third job control tool, you can return the job to the foreground at any time.
To suspend a job, type ctrl-z. When you do this, the job stops
running and waits for you to start it again as described below or to
kill it using the kill
command. (Be sure to cancel any suspended jobs
you don't want using the kill
command described in
section Job Control before you log out.)
To run a job in the background, type an ampersand (&) at the end of the command line that starts that job, or type the following after you've started and then suspended the job: bg.
After putting a job in the background, you can check its progress by typing the command jobs.
UNIX responds to this command by listing all the jobs that have been suspended during the current terminal session. This display looks similar to the following:
[1] + Running cc -o myprogram myprogram.c [2] + Stopped (tty input) otherprogram
UNIX will subsequently notify you when a job that's running in the background stops running.
To run a job in the foreground, type the following: fg
Using job control, you can have several jobs running at once. Only one job can be in the foreground at one time, but any number can be in the background. Background jobs can remain stopped or idle until you return them to the foreground, or they can be made to continue running concurrently in the background.
Background jobs that require terminal input will automatically stop running and wait until you move them to the foreground. You should keep a highly interactive program in the foreground and put slower, compute-bound programs in the background. You can also use job control to switch among several active jobs as they move from computation to interactive dialog.
A common use of job control, especially during program development, is to switch between the editor and the compiler. Suspending and continuing an editor is faster than running it every time. The speed increase is best if you edit large files or you switch back and forth between files frequently. As an added convenience, this puts you back into your file where you last were editing. You may find that you like this feature so much that you edit several files at once, using ctrl-z to suspend one editing session and the fg command to continue another one.
You will need to know how to specify which job to continue. If you
don't specify a particular job, fg
or bg
continues the
last job you suspended. This won't always be the job you want. To
find out what jobs you have running or suspended, use the jobs
command. The number listed next to each job is the number you specify
with fg
or bg
to continue that job in the foreground or
background. Consider the following example:
[1] Stopped vi myprogram.c [2] Stopped vi myotherprogram.c [3] Stopped vi yetanother.c [4] Stopped cc canonical.c
In this example, the user wants to continue compiling the C program
`canonical.c' in the background and resume editing
`myotherprogram.c'
in the foreground. To find out which jobs he has suspended, he types
the jobs
command. It lists each suspended job with an identifying
number. He puts the compile job (#4) in the background using the bg
command, and then he uses the jobs command to verify that it's
running. He then brings the edit job (#2) to the foreground using
the fg
command.
A useful hint: you can use the following procedure to switch back and forth between a compile job and an edit job. Use your editor to write out your changes to a source file, and then type ctrl-z to suspend the editor. Then run the compiler and direct its error messages to a listing file. Then switch between editing your source file and reading the listing file, trying to fix as many errors in your source file as you can after each compile.
Remember, the compiler compiles the disk file, not the copy the editor has in its memory, so be sure to write out your file before you suspend the editor. Similarly, when you go back to editing your file, be sure to continue your suspended editing session. Don't start another editing session every time you want to return to your file! If you're not sure if you suspended or exited the editor, use the jobs command to show your suspended jobs.
The following example shows how to suspend a job, run it in the background, check its status, and do something else while waiting for UNIX to say the job running in the background is finished.
rigel% cc -o myprogram myprogram.c ctrl-Z Stopped rigel% bg [1] cc -o myprogram myprogram.c rigel% jobs [1] + Running cc -o myprogram myprogram.c rigel% lpq no entries [1] + Done quad cc -o myprogram myprogram.c rigel% ls -F myprogam* myprogram.c test-data
In this example, a user uses the cc
command to compile a C program
that's in a file named `myprogram.c'. The user decides that the compile
job is taking too long and that she wants to have the terminal back
while the job completes, so she types ctrl-Z to suspend the job.
Because she wants the job to continue in the background, she types the
bg
command. She then types the jobs command to make sure the job is
running. Then she does other work while the job continues running in
the background, and UNIX notifies her when her job has finished
running.
If compiling this program always takes a long time, it would make sense for the user to run it as a background job in the first place. The following example shows how to do this and then check to see that the job is running.
rigel% cc -o myprogram myprogram.c & [1] 1962 rigel% jobs [1] + Running cc -o myprogram myprogram.c
UNIX is a multi-user, multi-tasking environment. You share computer resources with other users. You can help keep the environment responsive to yourself and other users by using its resources wisely. Wasted resources serve nobody, and contention during periods of peak usage can degrade response time to the point where nobody gets any useful work done.
A specific UNIX command that lets you run your background jobs
(See section Running jobs in the background) at low priority is the
nice
command. It helps prevent compute-bound applications from
slowing down interactive use of the computer. This includes your own
interactive use in the foreground. nice
accepts priority
numbers from 1 to 20, where higher numbers mean lower priority. For
example, to execute a program called number-cruncher
at low priority
in the background, you could type nice +20 number-cruncher &
Enter the nice command this way when you're in the C shell. When
you're in the Bourne shell, enter it the same way except replace the
plus (+) before the 20 with a minus (-).
Note that there are 4 different forms of nice
.
Another strategy for using processor resources wisely is spreading
the load -- performing work outside of periods of peak usage. The
w
and uptime
commands list load averages.
These commands return three numbers which describe cpu usage averaged over the last 1, 5, and 15 minutes. If you see high load averages, consider logging out and doing other work for awhile. You will enjoy better response when the load averages come down, and you will help the current users get their work done faster.
Some systems have the batch command. It allows you to submit jobs into a queue which then gets run serially. This is a useful way to limit CPU bound programs. Sometimes the at command can be used to postpone work until later.
You will find that periods of peak usage are cyclic, peaking every day in the afternoons and evenings, and during the academic year just before due dates for computer assignments. If you wait until the system is heavily loaded, you won't have much choice of when to do your work. Do your work early.
You might want to put the uptime command in your `.login' file.
Although current disk drives afford each user ample storage for ordinary needs, disk space is finite. Your files count against the total disk space available for anyone's use. UNIX provides tools that let you limit your permanent storage to what you really need.
These tools include the du
command, which tells you how much space
you're using, the piping utility, which reduces the need for temporary
files, and a hierarchical file system, which makes it easy to organize
your files.
Another way to use disk space efficiently is to delete all files you don't need.
To use the du
command, type the following: (this sorts usage in
reverse numerical order)
du | sort -rn | more
UNIX responds by giving you a number that is the amount of disk space you're using, in kilobytes. Some systems give this number in 512 blocks, instead of K.
UNIX's hierarchical file system is one of its strengths. You should utilize this system placing no more than 30 or 40 files in any one directory. This will actually decrease disk storage, because you won't be afraid to delete a file when you know what's in it. In addition, it will increase the speed at which the computer can find a specified file.
Another way to conserve disk space is to not save files because you "might need them someday." If you want to keep them indefinitely, download them to a micro and keep them on your own floppy disk, or write them to tape or floppy disc That way, you'll have your own copy even when your account expires, and you can always upload them when you want them on line again. If you think it takes too long or costs too much to do this, reconsider how much keeping the file around indefinitely is worth to you.
You can also use any of the following methods to help you delete files:
compress
uses Lempel-Ziv-Welsh coding for compressing files.
Most files can be compressed to half of their original size
thus saving on disk space. You should compress any files that
you do not use frequently as this will help keep from going
over your disk space limits. compress
is executed as
follows, with filename being replaced with the name of
the file (or files) to be compressed.
compress filename
The compressed file is stored under the name `filename.Z'. The `.Z' extension on the filename lets you know that this is a compressed file. Remember that any compressed file must be treated as a binary file for purposes of file transfer.
In order to uncompress a file, use the uncompress
command. The resulting uncompressed file will be without
the `.Z' extension.
uncompress filename.Z
You can use the command zcat
to look at a compressed file
without uncompressing it. A typical way to look at a compressed text
file is as follows:
zcat filename | more
UNIX provides tools such as screen editors, I/O redirection, piping,
and the on-line documentation systems that reduce the need for printing files.
One of the biggest savers is the various previewers (for
groff
, TeX and PostScript) available.
You can help reduce turnaround time for printouts by printing only when hard-copy output is necessary and by not printing duplicate copies of files. Printing each version of a program and duplicates of files is counterproductive; you'll spend as much time tracking which piece of paper matches which file as you gain any other way. With good use of editors, window systems, and other tools you may never need a print out. Many homework assignments are both distributed and turned in electronically by mail or news now.
Most commands get their input from standard input, which is usually the terminal, and send their output to standard output, which is also usually the terminal. Errors go to standard error. I/O redirection and piping allow you to specify otherwise.
I/O redirection lets you tell a command to read its input from a file, write its output to a file, or both. Piping allows you to tell a command to read its input from another command's output or even to read its input from the output of a string of several commands.
For example, let's assume you want to compute the wages earned by all professors in the College of Business during the past five years. The program you are using will read in data one line at a time. You could process the information line by line, typing in each piece of data each time the program asked for it, or you could do it much more quickly by using input output redirection. Your command line would look something like this:
program < datafile > resultsfile
With input output redirection, you would simply need to create a `datafile', and then look at the `resultsfile'.
If your data needs to be processed by several programs, you can use piping to save quite a bit of time.
cat datafile | program1 | program2 | program3 > resultsfile
In this case, data is taken from `datafile', processed by
program1
which passes it on to program2
which process it
farther and passes it on to program3
which processes it and
placed it into resultsfile.
To get input for a UNIX command from a file instead of the terminal, enter the command as follows:
command options arguments < inputfile
Replace command, options and arguments with the full command as you would normally enter it. Replace inputfile with the file from which the command is to get its input.
For example, to execute the program myprog
and have it draw its
input from the file myinput
, you'd type the following:
myprog < myinput
To send the output generated by a UNIX command to a file rather than to the terminal, enter the command as follows:
command options argument > outputfile
Replace command, options, and argument with the full command as you would normally enter it. Replace outputfile with the file to which the command is to send its output.
For example, consider the grep
command, which is used to search a file
for a string and write all the lines that contain that string to the
standard output device. In the following example, the grep
command
searches the file `myprog.c' for the string `counter' and prints all
the lines that contain counter at the terminal:
grep counter myprog.c
The grep
command could also be used to place all the lines that
contain `counter' in a file called `counter-matches' instead.
The following example shows how grep would do that if you redirected its
output to `counter-matches':
grep counter myprog.c > counter-matches
You could then manipulate counter-matches as you would any other file.
Piping is used in one of the following ways: to tell a command to read its input from another command's output, or to tell each command in a string of commands to get its input from the output of the last command.
To tell a command to get its input from another command, type the following:
anothercommand | command
Replace anothercommand with the command that is to generate the output, and replace command with the command that is to get the output. (Note that the `|' symbol is usually found on the far right side of the keyboard.)
A common way to use piping is with the more command, which causes its
input to print at the terminal one screenful at a time. For example,
the following command causes the output of the grep
command to go to
the more command, which prints grep
's output at the terminal one
screenful at a time:
grep counter myprog.c | more
While the grep
command is executing, grep
's standard output feeds into
more's standard input, and more's output goes to its standard output,
which in this case is the terminal.
To tell each command in a string of commands to get its input from the command before it, type the following:
firstcommand | secondcommand | lastcommand
Replace lastcommand with the command that is to get its input from secondcommand, and replace secondcommand with the command that is to get its input from firstcommand.
The following example runs the program myprog
and sends its
output to the grep
command. It then causes the grep
command to look for all occurrences of the string `counter' in
myprog
's output and sends the grep
command's output (all
the lines of myprog
that contain the counter string) to the
more
command. The more
command then sends the grep
command's
output to the terminal screen (which is the more
command's standard
output).
myprog | grep counter | more
By now, you should begin to see the power of piping and I/O redirection. They provide a highly general way to put together simple commands to perform complex operations.
Programming languages that run under UNIX are usually integrated into this system. Thus if you write an ordinary user program that reads and writes to your terminal, you can tell it to read from a file and write to a file instead. This can save you a lot of time writing and debugging your programs.
For example, suppose you have inserted debugging statements into your
code which write out the values of variables at various points in the
program. You now find that your program writes so much output that it
scrolls off the screen too quickly. You can pipe your program's
output through more
by typing the following:
myprog | more
Or suppose your program (myprog
) prompts you for input at your
terminal and you discover a bug that occurs well into the program.
When trying to debug the program, you might find that it takes a long
time to get to the point where the error occurs. You can tell your
program to read its input from a prepared file called input-file
instead of your terminal by typing the following:
myprog < input-file
You could combine these steps by using both piping and I/O redirection as follows:
myprog < input-file | more
If you still find you're wading through too much output that's unrelated to the bug, you could search through your program's output for a specific error message that includes the string `uninitialized' as follows:
myprog < input-file | grep uninitialized | more
Unfortunately, not all UNIX commands can have their input or output redirected. As noted before, UNIX commands read from standard input, which is usually the terminal, and write to standard output, which is also usually the terminal. When you specify I/O redirection or piping, the UNIX shell redefines standard input and output for each command to be files or other commands as you specify. The problem is that not all commands use standard input and output.
Some UNIX commands write error output to standard error.
Output that goes to standard error can be redirected just like output
that goes to standard output. (Note) csh
and sh
handle
standard error redirection slightly differently, csh
is
explained here)
A notable example is the output of the C compiler that is executed by
typing the cc
command. If you type the following command,
more
won't get any input, because the cc
command's
output will go to standard error:
cc myprog.c | more
To overcome this problem, add an ampersand (`&') after the vertical bar (`|'), as in the following example:
cc myprog.c |& more
Similarly, if you want to send the cc command's output to a file called `error-file', place an ampersand after the right arrow (`>') as in the following example:
cc myprog.c >& error-file
Some commands like vi
must talk to the terminal and simply fail
under I/O redirection.
On most machines (except DYNIX), file completion can be turned on by typing: set filec.
On some systems, file completion can be turned on by typing: set complete
On machines which do not have file completion in the C shell,
you will need to use an alternative shell like bash
.
Will cause the machine to list all the commands/files which could complete the string you have typed in.
UNIX files are backed up to tape daily and can be restored from tape to disk if necessary. This is a time consuming process which may take up to 24 hours. You can request that it be restored by sending mail to `sysgroup'. The backup system is not designed to be a guarantee of protection, but to give a good chance of recovering from a disaster. A best effort attempt will be made to restore the file.
Make sure that you don't have another file saved with the same name as the file being restored. If you do, the restored file will overwrite it.
If the file that you deleted was on-line for at least 24 contiguous hours sometime during the previous week, your chances for restoration are pretty good. If the file was on-line for less than 24 contiguous hours, or was deleted more than one week before you request restoration, the chances that it can be restored drops considerably. We only keep daily tapes for a week and weekly tapes for a month. This means that a file that existed for a day between two old weekly tapes will not be saved on tape.
If you have data on a different tape that originated from a different place, you can have the files on the tape restored to your home directory on any machine in the CS Department. You should send mail to `sysgroup' and drop off your tape in PCAT 144. The tape must be a magnetic tape (800, 1600, or 6250), Sun cartridge, HP cartridge, or Exabyte tape. The files must be in one of the following formats: tar, ansi-labelled, dd, cpio, or dump. Describe in your mail message to backup what the format of the tape is and where you want the data stored.
There are a number of ways to back up your files onto some sort of secondary media. If you have a PC or Mac, you can transfer your data to floppies. Otherwise you can use the following method. Other methods are available via special arrangement with Sysgroup.
For this method, you will need 1/4" data cartridges. They come in several sizes, there are two common sizes available 450 ft (which will contain aproximately 45 Megabytes) and 600 ft (which will contain aproximately 60 Megabytes).
Each of the Tektronix 4319 workstations in both the CS terminal room and
the EE grad cad lab have a scsi tape drive. You can login to the 4319's
in the CS terminal room using the same login name and password you use
on rigel
.
To backup or restore files using a scsitape you will either need to use
tar
or cpio
. The devices for the scsitape are /dev/rmt8
if you want to have the tape rewind after you have tar
'ed or
cpio
'ed a file, or `/dev/rmt12' which will not rewind when the
tar
or cpio
command is done.
Tar
Method:
To backup files: tar -cvf /dev/rmt12 filenames To restore files: tar -xvf /dev/rmt12 filenames For table of contents: tar -tf /dev/rmt12
Cpio
Method
To backup files: echo filenames | cpio -V/dev/rmt12 -ovc To restore files: cpio -ivcd -V/dev/rmt12 For table of contents: cpio -ivct -V/dev/rmt12
For more information Read the tar
(1), cpio
(1), and mt(1)
manual pages.
Example
Using tar
:
% cd % ls file1 file2 file3 file4 % tar -cvf /dev/rmt12 file1 file2 file1 file2 % tar -tf /dev/rmt12 file1 file2
(Using cpio
)
% cd % ls file1 file2 file3 file4 % echo file1 file2 | cpio -V/dev/rmt12 -ovc file1 file2 % cpio -ivct -V/dev/rmt12 file1 file2
This section provides both a general description of USENET news and an explanation of how to use various programs to access it.
USENET is an informal network of tens of thousands of computers worldwide. Many sites are running UNIX, since the original goal of USENET was to tie together the UNIX community for advice and mutual support.
USENET is like an electronic bulletin board service. It allows users at participating sites to post electronic news articles around the network, and to read news items from other users at other sites. Each site gets copies of all news items.
News items are posted to a specific newsgroup. This restricts discussion of a given topic to people who are interested in it. There are newsgroups to discuss bicycles, books, the C programming language, database management, ham radio, and thousands of other topics. You can post news items for distribution to sites around the world, or just to your local community.
Since there may be over 1 million articles active at any given time, they are arranged based on the topic to which they relate. Usenet topics are arranged in a hierarchical manner (general topics are broken into more specific interests), such that, for example, articles relating to the 386bsd operating system will be under the `386bsd' group, under the `os' subhierarchy, under the `comp' hierarchy. This group is represented by the dotted notation `comp.os.386bsd' (pronounced: "comp oh-es three-atee-six bee-es-dee". Many may also include "dot" between the divisions). Articles under this group all pertain to that topic. This allows the user to interact with only subjects in his/her particular interests.
There are several different user interfaces for USENET news:
rn
(or rrn
), nn
, gnus
(within emacs
),
tin
. Three obsolete newsreaders, which you may hear references to
are readnews
, vnews
, and notes
.
Most of these use the NNTP protocol to read news from a remote server which stores all articles. Other machines can then run the client program and it will retrieve the articles from the news server.
This section describes the USENET culture and customs that have developed over time. All new users should read this section to find out how USENET works.
USENET is a large collection of computers that share data with each other. It is the people on these computers that make USENET worth the effort to read and maintain, and for USENET to function properly those people must be able to interact in productive ways.
The following is a guide to using it politely, effectively and efficiently. Communication by computer is new to almost everybody, and there are certain aspects that can make it a frustrating experience until you get used to them. This document should help you avoid the worst traps.
The easiest way to learn how to use USENET is to watch how others use it. Start reading the news and try to figure out what people are doing and why. After a couple of weeks you will start understanding why certain things are done and what things shouldn't be done.
Because your interaction with the network is through a computer it is easy to forget that there are people "out there." Situations arise where emotions erupt into a verbal free-for-all that can lead to hurt feelings.
Please remember that people all over the world are reading your words. Do not attack people if you cannot persuade them with your presentation of the facts. Screaming, cursing, and abusing others only serves to make people think less of you and less willing to help you when you need it.
Hasty words create more problems than they solve. Try not to say anything to others you would not say to them in person in a room full of people.
Please remember -- you read netnews; so do as many as 1,000,000 other people. This group quite possibly includes your boss, your friend's boss, your girlfriend's brother's best friend and one of your father's beer buddies. Information posted on the net can come back to haunt you or the person you are talking about.
Never say in ten words what you can say in fewer. Say it succinctly and it will have a greater impact. Remember that the longer you make your article, the fewer people will bother to read it.
Most people on USENET will know you only by what you say and how well you say it. They may someday be your co-workers or friends. Take some time to make sure each posting is something that will not embarrass you later. Minimize your spelling errors and make sure that the article is easy to read and understand. Writing is an art and to do it well requires practice. Since much of how people judge you on the net is based on your writing, such time is well spent.
When you post an article, think about the people you are trying to reach. Asking UNIX questions on rec.autos will not reach as many of the people you want to reach as if you asked them on `comp.unix.questions' or `comp.unix.internals'. Try to get the most appropriate audience for your message, not the widest.
If your message is of interest to a limited geographic area (apartments, car sales, meetings, concerts, etc.....), restrict the distribution of the message to your local area. Some areas have special newsgroups with geographical limitations, and the recent versions of the news software allow you to limit the distribution of material sent to world-wide newsgroups.
Without the voice inflections and body language of personal communications, it is easy for a remark meant to be funny to be misinterpreted. Subtle humor tends to get lost, so take steps to make sure that people realize you are trying to be funny. The net has developed a symbol called the smiley face. It looks like `:-)' and points out sections of articles with humorous intent. No matter how broad the humor or satire, it is safer to remind people that you are being funny.
But also be aware that quite frequently satire is posted without any explicit indications. If an article outrages you strongly, you should ask yourself if it just may have been unmarked satire. Several self-proclaimed connoisseurs refuse to use smiley faces, so take heed or you may make a temporary fool of yourself.
Avoid posting messages to more than one newsgroup unless you are sure it is appropriate. If you do post to multiple newsgroups, do not post to each group separately. Instead, specify all the groups on a single copy of the message. This reduces network overhead and lets people who subscribe to more than one of those groups see the message once instead of having to wade through each copy.
When you request information from the network, it is common courtesy to report your findings so that others can benefit as well. The best way of doing this is to take all the responses that you received and edit them into a single article that is posted to the places where you originally posted your question. Take the time to strip headers, combine duplicate information, and write a short summary. Try to credit the information to the people that sent it to you, where possible.
One of the biggest problems we have on the network is that when someone asks a question, many people send out identical answers. When this happens, dozens of identical answers pour through the net. Mail your answer to the person and suggest that they summarize to the network. This way the net will only see a single copy of the answers, no matter how many people answer the question.
If you post a question, please remind people to send you the answers by mail and at least offer to summarize them to the network.
Before you submit a follow-up to a message, read the rest of the messages in the newsgroup to see whether someone has already said what you want to say. If someone has, don't repeat it.
Once something is posted onto the network, it is probably in the public domain unless you own the appropriate rights (most notably, if you wrote the thing yourself) and you post it with a valid copyright notice; a court would have to decide the specifics and there are arguments for both sides of the issue.
If you are using facts to support a cause, state where they came from. Don't take someone else's ideas and use them as your own. You don't want someone pretending that your ideas are theirs; show them the same respect.
There are quite a few nesreaders available, but we support only two:
rn
, nn
. There are other newsreaders installed, on various
machines You are free to use whatever program you like best, but keep in
mind that the various packages have different levels of support.
All newsreading programs have one file in common: `.newsrc'. This file (located in your home directory) contains a listing of all of the currently active newsgroups.
It also indicates which groups you are subscribed to, i.e. the newsgroups that a newsreader will show you. Each newsgroup name is followed by a `:' or `!'. A colon indicates that you are currently subscribed to that group. An exclamation point indicates that you are currently unsubscribed to that group.
The `.newsrc' file keeps track of which articles you have read. Following the colon or exclamation point are the article numbers that you have read in that particular newsgroup.
There are several ways in which your `.newsrc' file can be setup. You
could allow your newsreader to create it for you, but it will subscribe
you to every single group, which is obviously not desired. The
newsetup
program will have the same behavior.
A better option is to use the new-newsrc
program, which will
create your `.newsrc' file, and then, automatically, invoke
eep
, which allows the user to determine which groups to subscribe
to. eep
will also allow you to change the order of your
`.newsrc' which can make reading news much easier.
An alternate way to set up your `.newsrc' file is to use let
newsetup
create it for you. Then using an editor (i.e. vi
or emacs
, move the newsgroups you want to read to the top.
When you are done with that, replace the remaining colons in the file
with bangs (`!').
rn
rn
is the program that is used to read news about a variety
of subjects that are posted to USENET. In order to run rn
, all
you need to do is to type rn(2)
You can also specify the newsgroup you want to read, like rn rec.arts.startrek.current.
If no newsgroup name is specified then the rn
program goes
through your `.newsrc' file, which has a list of all the
newsgroups. If a `.newsrc' file does not exist in your home
directory, then rn
creates one in your directory (using the
newsetup
program).
If you type the name of the newsgroup like `rec.humor' in the
example above, then rn
directly takes you to that newsgroup and
you can start reading articles in that newsgroup.
rn
operates on three levels:
rn
operates very much like the utility more which is
basically for a screen-oriented display.
.newsrc
.
On any level, and at any prompt you can type h
for a list of available commands. This command will be very
useful as you try to do more and more operations in rn
. Typing
space when rn
prompts you for input will make it do the normal
thing. Every prompt will have a set of options which can be
typed and so at this point you can either type space
(for first option) or something else as specified.
Upon startup, rn
does the following:
Then it goes into the top level, the newsgroup selection level.
In this section, some of the commands that you can use are described. SP stands for the space--bar.
When you are at this level your prompt will look something like:
************33 unread articles in rec.humor-- read now? [ynq]
At this prompt you can use any of these commands:
rn
will ask if you want to subscribe.
In this level rn
selects articles from the newsgroup that you
are reading in the order in which they have arrived at your site. In
this level you are not asked whether you want to read an article and
then display it, instead, it displays the first page of the article and
at the end of the article it displays the following prompt:
-- End of article 256 ( of 900 ) -- what next? [npq]
At this point you can type any one of the following options:
At the pager level (within an article) the prompt looks like :
--------More--(17%)--
At this prompt you can type any of the following commands:
rn
rn
has a set of options which you can use to tailor the way in
which rn
works to your liking. Some of the options that you can use are:
rn
to enter the subject search mode automatically.
(this speeds up reading and searching for articles in
a newsgroup)
This section on rn
is just an annotated description of the features that
will enable you to use rn
comfortably. there are a lot of other options
which you will want to use and for a detailed description of these do a
man rn
at the command line.
Pnews
Pnews allows you to post to a newsgroup. In order to run just type, Pnews newsgroup or just Pnews
Pnews is a friendly interface for posting news articles. It will ask several questions, then allow you to enter your article, and then post it.
nn
nn
stands for No News and is a program for reading netnews.
You may be wondering why it is called No News. That is part of its larger
title: No News is Good News. The philosophy behind the design of
nn
is to minimize the amount of time spent in reading news. Thus,
no news is good news because you don't have to spend any time reading
news. (3)
nn
modes
nn
has two modes: selection mode and reading mode. When
you first enter a newsgroup you are in selection mode. From this screen
you select which articles you would like to read. Once this is done, you
enter reading mode to read the articles.
The following commands will work in both modes:
nn
.
command & command is an nn
command. Some sample nn
commands are:
nn
program.
nn
without updating anything.
The following figure shows a sample selection mode screen. This is what you will see whenever you enter a newsgroup. Note the following information:
Newsgroup: rec.arts.startrek.current Articles: 786 of 14/1 a.Kymberlee Ricke 16 >>Spoilers for DS9: "Playing God" b.Blanche Cohen 13 >>> c.Sidra Vitale 42 >The Future of Star Trek d.Jeff Hitchin 16 >Can trills transport? e.Andre Bratu 25 >> f.D t Omniscient 18 > g.Sean Butler 35 >> h.108swelnis 13 >>> i.Mike Who 28 >>>> j.holthausc@urvax 12 Top Ten Guys k.holthausc@urvax 21 >Marina Sirtis' Opinions on Star Trek l.acm0200@mtroyal 19 >>>Star Trek V m.acm0200@mtroyal 36 >>>>> n.Chem C3 Lab 25 >>>>> o.KAUFMAN 44 >>>> p.Dennis Bailey 4 >>>> q.KAUFMAN 38 >>>> r.Taki Kogoma 31 >>>> s.Taki Kogoma 53 >>>> -- 11:41 -- SELECT -- help:? -----Top 16%-----
In selection mode you select which articles you wish to read by pressing the appropriate article id key. There are several ways to do this:
Here are some examples:
You can tell if an article is selected because it will be highlighted.
Each article has an article attribute associated with it. This attribute indicates the status of the article (have you seen it? have you read it? etc.). The attribute is shown either by highlighting the article line, or placing a single character following the article id.
In most cases, the initial display of articles has the unread attribute associated with each article. This is indicated by a blank space after the article id. In our example you can see that all of the articles are marked as unread.
When you select an article it will be highlighted (if your terminal cannot do highlighting then it will be marked with `*'). This is the selected attribute. Articles will remain selected if you mark them selected and then leave the newsgroup without reading them.
An article is marked read after you have read it. These articles will be marked permanently read when you leave the newsgroup and will not be displayed the next time you enter the newsgroup. The read attribute is indicated by `.'
One final attribute is the seen attribute. This indicates that an article has been presented but not read. These will be marked read when you leave the newsgroup.
There are several other article attributes, but they are beyond the scope of this document.
This brief introduction to attributes was necessary to understand some of the following selection mode commands:
In reading mode the selected articles are displayed one at a time. Each article is marked read after you have read it. You will enter the next newsgroup after reading the last selected article (or the current newsgroup if you used the Z command).
The following are some of the commands that are available in reading mode:
There are three commands for saving articles. These can be invoked from either reading mode or selection mode:
When using one of these three commands, nn
will give you a
default file name. You can kill this and enter your own. You can also
associate a file name with a particular newsgroup via your
`.nn/init' file (this file will be discussed later).
Posting and responding to articles can be done from either reading mode or selection mode. Two important notes concerning posting:
The following commands are available for posting and responding. The first three give you the option of including the current article.
nn
asks for the newsgroup.
Distribution refers to who will see it. Sometimes the issue may be of interest only to the local community. In these cases you should choose as small a distribution as possible. This helps reduce network congestion. At PSU CS, we have the following possible distributions:
When you are done editing your response you will be prompted with several options. The two that are used the most often are send to send the letter or post the article and abort to throw the letter/article away.
In this section we will discuss three important files: your kill
file, the `.newsrc' file, and the .nn/init
file.
As was mentioned earlier, you can use the K command to kill a
subject permanently. Articles of this subject heading will no longer
be displayed. nn
also has an auto-select feature where you can
specify that certain articles automatically be marked as selected.
nn
will ask you several questions after you press K. The
first one is whether you would like to `k'ill or `s'elect.
The next question asks if you wish to perform the action based upon
`s'ubject or `n'ame. If you choose name then you must enter
the name.
You will then be asked if you wish for this to apply to the current `g'roup only or `a'll groups. The final question is how long should this entry remain in your kill file. Each question has a default answer which will be used if RET is pressed. In addition, pressing RET in reply to the first question will perform a default action of killing all articles with the same subject for 30 days.
nn
will use the
same `.newsrc' that rn
uses (see section How to read news, for
more info), but nn
does not use the
`.newsrc' file to determine what order to display the groups.
You can switch from rn to nn
and retain the same newsgroup
subscriptions you used to have.
The .nn/init
file allows you to customize nn
. You can
set certain variables, define macros, customize your article header
presentation, remap keys, and indicate the desired presentation
sequence of articles. Unfortunately, a detailed discussion of the
nn/init
file is beyond the scope of this course. Interested
users should consult the manual page for nn
.
The default init file is located in `/usr/local/lib/news/nn/init'. If you copy this to your `.nn' directory with the command
cp /usr/local/lib/news/nn/init ~/.nn/init
You can then edit it. This is a very good way to put the critical news groups as the first groups you read.
Finally we're ready to experiment with nn
! There are three
common ways to invoke nn
:
nn nn -g nn -anumber
For starters, simply type nn
. This normally sequences you
through all of the groups that you are subscribed to. Initially
you are subscribed to all groups.
This is the only time you'll have to do this. Now type nn
. You
will see that it displays one of the newsgroups that you selected.
From here you should be able to use this handout to experiment with
nn
.
The `-g' option is used when you wish to go to a specific group.
You can also use G from within nn
to do the same thing.
nn
will prompt you for the group name. nn
will ask
`number of articles?' after you enter the newsgroup name. At
this point enter the number of articles which you would like to read
or a to see all articles. If you use G then you should answer
jump instead of all.
The `-aN' is used to limit the display to a maximum of N articles. For example, the following will display the last 10 articles in each newsgroup:
nn -a10
This is handy for getting up to date if you have not read netnews for a while.
One other command that you will find handy is the U command.
This is given from within nn
and it will unsubscribe you to the
current group.
In order to subscribe to a group, use either the `-g' option when
invoking nn
, or use the G command from within nn
to go to the group. This will jump to the group. From within this
group use the U command and nn
will resubscribe you to
that group.
I'd like to leave you with an advanced command that shows the power of
nn
. nn
provides a way to search all newsgroups for a
particular subject or a particular author! You cannot do this in other
newsreaders (such as rn
).
The format of the command is:
nn -mxX -sSubject all or nn -mxX -nName all
For example, to search for all article posted about pizza, type:
nn -mxX -spizza all
The `-n' and `-s' options cannot be used together. The meaning of the various option flags is left as an exercise for you.
That's it! Experiment with nn
and practice posting to a test
newsgroup. If you're feeling particularly adventuresome, you may want
to try to tackle the manual page for nn
(its about 80 pages!).
Portland State University is a part of the Internet network, but also provides connections to BITNET, UUCPnet and others. The following text was taken from a newsgroup and discusses the differences between the Internet and BITNET.
The Internet is not a single network; it incorporates the ARPANET, NSFNET, and many regional networks, which operate using the same family of communications protocols. Although it comprises networks administered by a variety of organizations, to the user it appears as an integrated whole. Just as anyone with a telephone can dial a friend anywhere in the country regardless of which local or long--distance telephone companies own the lines along which the signals travel, a computer connected to the Internet can communicate with any other computer on the Internet. The number of universities with access to this network has been growing fast since the National Science Foundation introduced NSFNET to provide researchers with high--speed access to supercomputer centers. In early 1989 it reaches around 300 academic institutions, and at many of these any computer or terminal attached to the campus network has access to the network. The Internet supports a wide variety of network services: the most commonly used are electronic mail, transfer of files between computers, and the ability to link to a remote computer as if one were at a terminal connected directly. However, the network is designed to support much more sophisticated functions that will be necessary for achieving the vision of transparent access to remote resources. A single logical database may be distributed over several machines, and software running on a user's workstation can refer to files stored on a computer across the country just as if they were stored on the workstation. These advanced network applications are only just emerging from the experimental stage; currently most network use is conscious. A researcher sends a message to a colleague using her network address, or logs on to a remote computer.
Several institutions have made their online information systems or databases accessible to remote users who log in over the Internet. For instance, the CARL system in Colorado, the Dante database at Dartmouth, and RPI's information system can all be reached over the Internet. To protect copyright, the tradition of free, open access to all information held by libraries sometimes has to be compromised to comply with restrictions incorporated into licenses by the owners of databases. For instance, the MELVYL online catalog is accessible over the Internet but access to MEDLINE is restricted to users on the University of California campuses. Other institutions require passwords or have restricted remote access over the Internet entirely, even when it is technically simple. This conflict will have to be resolved before the vision of a global information environment can be achieved, but such resolution will not come without considerable experience of pragmatic approaches.
In some disciplines, mainly technical fields such as computer science or engineering, access to the Internet is vital to keeping up with developments. Electronic mail is much more heavily used for communicating with colleagues around the world than paper, and the mail system supports an enormous number of mailing lists which function as bulletin boards on various topics. A wide variety of information, including working papers, reports, software, and documentation is accessible over the Internet through an informal distribution scheme based on a file transfer facility known as "anonymous FTP". FTP (File Transfer Protocol) allows a user to transfer files from one computer to another. Normally the user needs to sign on to an authorized computer account on both computers. However, anyone who has files or documents that they wish to make publicly accessible can store them so that they can be accessed by others who sign on as "anonymous". Once signed on, the remote user can look at a list of available files and request that some be transferred to his own computer. This facility provides a primitive form of networked information server.
The potential of networks for accumulating and distributing information in specialized areas is demonstrated by an example at the University of Delaware. With support from the Delaware Institute for Medical Education and Research, Dr Borgaonkar of the Medical Center of Delaware maintains two databases that support both research and practice in cytogenetics, the study of heredity through genetic means and the analysis of cells. The first, "Chromosomal Variation in Man -- A Catalog of Chromosomal Variants and Anomalies", is a bibliographic database which contains citations to relevant material scattered in the literature. The second, "International Registry of Abnormal Karyotypes -- Repository of Human Chromosomal Variants and Anomalies", holds unpublished data on about 350,000 chromosomal analyses, including 65,000 abnormalities. The information is submitted in personal communications, often over BITNET, by over 300 practitioners and researchers around the world. The databases are published in printed form, but there is a four--year interval between editions of the catalog and two years between editions of the registry. The field is developing rapidly, and online access is essential for locating recent data. Currently, most remote users send requests by electronic mail. The search is performed locally by Dr. Borgoankar or his staff, and the results returned by electronic mail. The university's support group for academic computing expects more demand for direct online access in the future, and the computer on which the database is stored is already accessible from the Internet, BITNET, and commercial packet--switched networks. (Copyright, Digital Press, 1989)
Campus Strategies for Libraries and Electronic Information (1989) and Campus Networking Strategies (1988) are both published by Digital Press. Call 1-800-343-8321, the Educational Services Order Fulfillment Division. CSLEI is $34.95 (Part # EY-C185E-DP-SS). CNS was $30 (Part # EY-6736E-DP).
Both books are also available at reduced prices through EDUCOM (609) 520-3340. I believe CNS is $20, and CSLEI is $25. You can place an order over BITNET by sending mail to PUBS@EDUCOM.
Ftp
can be used from all machines in the Computer Science Department.
The easiest way to use the ftp program is to use
ftp command followed by the name of the machine
with which to connect:
ftp hostname
After executing this command, you will be prompted for a name and a password. Your response will depend on whether or not this is an anonymous ftp. An anonymous ftp allows anyone to login with a name of anonymous and access publically accessible files. When using anonymous ftp, the password prompt should be answered with the full E-Mail address of the user. An example of an anonymous ftp login would be:
rigel ftp wuarchive.wustl.edu Name (wuarchive.wustl.edu:moeh):anonymous Passwd (wuarchive.wustl.edu:anonymous):moeh@rigel.cs.pdx.edu 331 Guest login ok, sent ident as password. 331 Guest login ok, access restrictions apply. ftp>
If you are not using an anonymous ftp, then you would normally be logging into your own account on another machine. In this case, the name prompt would be answered with your login name, and the password prompt would be answered with your password on the remote machine. An example of a normal ftp login would be:
(rigel) moeh {519}> ftp cs.pdx.edu Connected to cs.pdx.edu. 220 cs.pdx.edu FTP server (Version 5.89 Wed Jul 31 13:15:11 PDT 1991) ready. Name (cs.pdx.edu:moeh): moeh 331 Password required for moeh. Password: <moeh's password> 230 User moeh logged in. ftp>
Both anonymous and normal ftp should now display the ftp> prompt. You can always get help from the ftp> prompt by typing a ? or help. This will display a list of possible commands. The two most used commands are get which will retrieve a file, and put which will send a file. If the file is not a text file, then binary mode must be used. An example of retrieving a binary file with a file name of file1.c would be:
ftp> bin 200 Type set to I. ftp> get file1.c 200 PORT command successful. 150 Opening BINARY mode data connection for meetinfo03.Z (864 bytes). 226 Transfer complete. local: file1.c remote: file1.c 864 bytes received in 0.0018 seconds (4.8e+02 Kbytes/s) ftp>
The following is a list of some useful ftp commands and a brief description.
The Internet is financed in a cooperative effort. All sites share the charges incurred by users. Somebody is paying the long distance phone bills for your connection in exchange for us paying for any costs of connecting through Portland State University. As a courtesy to the Internet, please do not explore ftp sites outside of Portland State University during normal business hours. By accessing these ftp sites during non-business hours, 5:00 pm to 8:00 am, you will be saving PSU money and as a bonus your connections and transfers will be swift.
Rcp stands for remote copy. It is like cp, but between two separate machines. In order to use rcp, you must have an account on both machines, and have a .rhosts file on the machines involved ( Note: .rhost files are a security risk and should only be used if absolutely necessary). The rcp command has the following format:
rcp host1: file1 host2: file2
This will transfer file1 on machine host1 to file2 on machine host2. If the host is left out, then it defaults to the current machine. An example of transferring a file from rigel to the current machine would be:
rcp rigel.cs.pdx.edu:myprogram.c localprogram.c
This section deals with uploading and downloading files from you home computer over a modem. Two programs will be illustrated: sx sb sz , and kermit.
Sx rx, sb rb, and sz rz implement the xmodem, ymodem, and zmodem file transfer protocols respectively.
Xmodemis one of the most widely used file transfer protocols. The original Xmodem protocol uses 128-byte packets and a simple "checksum" method of error detection. A later enhancement, Xmodem-CRC, uses a more secure Cyclic Redundancy Check (CRC) method for error detection. Xmodem protocol always attempts to use CRC first. If the sender does not acknowledge the requests for CRC, the receiver shifts to the checksum mode and continues its request for transmission.
Xmodem-1K
Xmodem 1K is essentially Xmodem CRC with 1K (1024 byte) packets. On some systems and bulletin boards it may also be referred to as Ymodem. Some communication software programs, most notably Procomm Plus 1.x, also list Xmodem-1K as Ymodem. Procomm Plus 2.0 no longer refers to Xmodem-1K as Ymodem.
Ymodem is essentially Xmodem 1K that allows multiple batch file transfer. On some systems it is listed as Ymodem Batch.
Ymodem-g
Ymodem-g is a variant of Ymodem. It is designed to be used with modems that support error control. This protocol does not provide software error correction or recovery, but expects the modem to provide the service. It is a streaming protocol that sends and receives 1K packets in a continuous stream until instructed to stop. It does not wait for positive acknowledgement after each block is sent, but rather sends blocks in rapid succession. If any block is unsuccessfully transferred, the entire transfer is canceled.
Zmodem is generally the best protocol to use if the electronic service you are calling supports it. Zmodem has two significant features: it is extremely efficient and it provides crash recovery.
Like Ymodem-g, Zmodem does not wait for positive acknowledgement after each block is sent, but rather sends blocks in rapid succession. If a Zmodem transfer is canceled or interrupted for any reason, the transfer can be resurrected later and the previously transferred information need not be resent.
The fallowing are small examples on how this programs can be used. These commands are executed on the UNIX machine first, and then the appropriate option is selected on your PC to start the transfer. The following are examples of these commands using the xmodem protocol. The other protocols can be used the same way.
Kermit was developed at Columbia University. It was designed to facilitate the exchange of data among very different types of computers (mainly minicomputers and mainframes). You probably will not need to use Kermit unless you are calling a minicomputer or mainframe at an educational institution.
Version 4C of this file transfer program is available on most computers. Kermit can be used in comand-line mode or interactively. In both cases, kermit is intended to be run on each of the two computers that are in communication; one prepared to send and the other prepared to receive.
To use kermit in command-line mode, type the following:
kermit options filenames
replace options with the options you want to use. The -l option, indicating location, and the -b option, indicating baud rate, are both required. The -r option indicates you want to receive the files indicated in files, and the -s option indicates you want to send these files. Replace filenames with the names of the files you want to transfer. To get help, use the -h option.
To use kermit in interactive mode, type the following:
kermit
You should then see the fallowing:
(rigel) moeh {1246}> kermit C-Kermit 5A(189), 30 June 93, SunOS 4.1 (BSD) Type ? or HELP for help
In interactive mode, use the ? command to get help.
Compress is a program that saves disk space by reducing the size of your files. It is described in Section See section Compress and Uncompress
Tar is used to archive files and/or directories to a single file, or to a magnetic tape. The two most useful tar modes are create and extract, denoted by a "c" and an "x" option respectively. The "f" option is used to specify the filename or tape device where the tar file will be saved. For example, if you have a directory, Mail, and you would like to archive this directory using the filename, mail1.tar, you would use the following command.
tar cf mail1.tar Mail
If you ever want to unarchive the tar file, mail1.tar, you could use the following command. Remember, untaring this file will recreate the Mail directory, destroying any existing directory named Mail.
tar xf mail1.tar
For more information take a look at Section See section Backing Up Files On Tape
The following is a synopsis of the Departmental computing facilities which are managed (or co-managed) by the CS Systems Staff.
This information can change very quickly, and, thus, may be slightly out of date (particularily in a printed copy). It was last updated on 19-Apr-94.
These machines change very quickly, the ones at the top are more stable
Both MSB and PCAT have an AppleTalk network, linked to the UNIX networks via 2 Shiva Fastpath gateways. There are a total of about 14 Macs scattered throughout both buildings. None for student access, though.
This appendix lists some of the more useful newsgroups, both local and worldwide. See section News, for more information.
The following is a list of the local PSU newsgroups and what they are intended for.
If you feel there should be another local newsgroup send a proposal to 'usenet@ee.pdx.edu'.
msgs
command accesses the identical messages as
the newsgroup `psu.msgs')
Portland State University Computer Science Department Systems Staff (Sysgroup) strongly recommends that you subscribe to the following newgroups and read them regularly:
You may also want to subscribe to these:
There are a wide range of groups available. Odds are that you will find more newsgroups about subjects which you are interested in than you will have time to read. In particular, you may want to look at `*.announce' newsgroups, since they are low volume.