This document contains some introductory information about and the Unix &
Linux operating system. Many of the commands discussed work on either
operating platform.
Logging In
To start utilizing your account, you must log-in to one of the many
computers available to you in room 1537, room 1422,or your office, to
name a few. In order to do this, you must have a Username and
a Password. The RCF will set your permanent username and your
initial password. You can change your password at anytime, see section
4.1 below for more details.
Lets say, for example, we want to log into computer #4 in 1537. The
login session will look like this:
login: username
Password: password
After you have logged in, you will see something like the following:
Sun Microsystems Inc. SunOS 5.9 Generic May 2008
You have mail.
rcf1537-4%
Using mail
Electronic mail is a very convenient method for communication with
colleagues locally, nationally, and internationally. There are
several ways to read and send mail, but the RCF is recommending that
you use the PINE mail program or a mail client such as MacMail or
Thunderbird. These programs have several user-friendly
attributes. These include a good
system for organizing your mail in a logical manner, on-screen help
(including a list of possible actions), and prompting for various
mailing options. PINE also makes you confirm that you want to delete a
message, so you are a bit less likely to delete messages by accident.
To start the PINE mailer, simply type pine at the system
prompt. The first time you do this, PINE will ask you a few questions
about how you want your mailer set up. Just answer yes to take the
system defaults; when you learn more about how PINE works, you can
modify PINE.
Useful Unix Commands And Utilities
The passwd command is used to change your password. You should feel free to change your password - but take care to choose it carefully. A good password should be difficult for anybody else to guess. Ideally, a password should not be a word found in a dictionary, your office number, your first or last name, or other similar things. Misspelled words are a good choice - particularly if they are entered in mixed case. Also, use symbols like $% or *# for some *#@%&*-ing variety.
Never tell your password to anyone. The RCF may ask you to change an obvious password detected by security programs, but no RCF member will tell you what to change it to nor ask you what your password is.
When you enter the passwd command, you will first be asked to enter your current password. Next you will be prompted for a new password, and then asked to type the new password again to be sure that you did not make a mistake in entering the new password. The characters you type will not be displayed as you type them. This is so nobody else can read your password from the screen while you are changing it. Below is an example of what a password change would look like on the screen for user gradstu.
gradstu@rcf1537-6% passwd
Changing password for gradstu
Old password:
New password:
Retype new password:
gradstu@rcf1537-6%
man - On-line Manual Pages
man is the command used to access the on-line reference manual pages. Suppose you wish to read more about the passwd command mentioned in section 4.1, if you type man passwd at the prompt, the screen will soon fill with information about how the passwd command works. Obviously, this requires that you know the command name. If you do not know a command name, getting on-line help is not the easiest thing to do. You can use man -k keyword, where keyword is a word that appears in the command description. This is vague, but as you will find out, so is man ! The manual pages can be a bit difficult to decipher, but you can ask the RCF for help reading them. You can also look in any of several books that the RCF has in room 1537.
Finger is a utility that shows who is currently logged on the system. You invoke it simply by entering finger at the prompt:
pollard@rcf1537-6% finger
Login Name TTY Idle When Where kieffer Gordon Kieffer pts/0 Tue 07:49 rcf1537-2 decheng Decheng Wang pts/3 Tue 10:19 diffusion tuthill Rick Tuthill pts/2 1:33 Fri 10:54 rcf1537-4 dhayes David Hayes pts/1 25 Tue 09:26 qmodz joeh Joe Horowitz pts/5 4 Tue 09:15 talos kieffer Gordon Kieffer pts/6 6 Tue 10:28 v90-233-60.dialup.um rkrantz Walter Rosenkrantz pts/7 Tue 09:51 gin scott Scott F. Conti pts/8 Tue 10:12 zoom decheng Decheng Wang pts/9 3 Tue 10:26 parmenides.gang.umasThe Login field is the Username of the person logged in; Name is their ``real'' name; TTY is the terminal number; Idle is the time between ``now'' and the last time they executed a command; When is when they logged in; and Where is the place they have logged in from.
The finger command can also be used to look up information about a specific user. For example, finger john will generate a list of all people on the system whose first name, last name, or username is john. When finger is used this way, you will get the login, real name, last login time, and other system information on each person fingered. The ``other system information'' includes when mail was last read and the person's plan. The plan is information the user wants to appear in their finger information. If you create a file named .plan (the period before the word plan is needed) in your top level directory, the contents of that file will be printed when another user fingers you. One of the differences between BSD Unix and Solaris Unix is in what finger information is printed. If you type finger john@rcf1537-6, you will get the rcf1537-6 finger information on john. This will include office and phone numbers (if available) in addition to the other information. Here is an example of what you might see; lets finger user stmary at rcf1537-6:
pollard@rcf1537-6% finger stmary
[rcf1537-6] Login name: stmary In real life: Don St Mary Directory: /u2/users/dlk/stmary Shell: /user/bin/csh Last login Sep 3 09:49 on pts/38 from wave.math.umass.edu New Mail recieve Tue Sept 10 09:14:02 2002 unread since Mon Sep 9 20:49:16 2002 No Plan. pollard@rcf1537-6%
The ls command lists the contents of the directory you are currently in. (If you want to check what directory you are in, use the pwd command which stands for ``path of working directory''). The following are examples of the ls command, with and without flags:
rcf1537-6% ls
GradeProgram.tar.Z latex2e-docs simmons NTD misc talks act-ay96.tex papers template.tex auctex.tar.gz setacct thesisls without flags lists the contents of the directory
rcf1537-6% ls -l
-rw-r--r-- 1 kieffer grad 124615 Feb 24 1995 GradeProgram.tar.Z -rw------- 1 kieffer grad 1474 Mar 25 1994 NTD -rw-r--r-- 1 kieffer grad 4710 May 17 13:58 act-ay96.tex -rw-r--r-- 1 kieffer grad 257021 May 11 1996 auctex.tar.gz drwxr-xr-x 2 kieffer other 1024 Aug 2 07:20 latex2e-docs drwx------ 2 kieffer grad 512 Aug 2 07:19 misc drwx------ 2 kieffer grad 512 Aug 2 07:18 papers -rwx------ 1 root other 261 Aug 5 1994 setacct drwx------ 5 kieffer grad 512 Aug 2 07:20 simmons drwxr-xr-x 3 kieffer grad 512 Aug 2 07:18 talks -rw-rw-rw- 1 kieffer grad 29297 Nov 8 1995 template.tex drwx------ 9 kieffer grad 512 Aug 2 07:19 thesisls -l lists in long format (reading left to right) permissions, number of links to file, owner of the file, the group the owner belongs to, number of characters or bytes, time of last modification, and the filename for each file in the directory.
rcf1537-6% ls -F
GradeProgram.tar.Z latex2e-docs/ simmons/ NTD misc/ talks/ act-ay96.tex papers/ template.tex auctex.tar.gz setacct* thesis/ls -F lists your files with a slash (/) after each filename if the file is a directory, an asterisk (*) if the file is an executable, and an "at" symbol (@) if the file is a symbolic link
There are many parameters to the ls command to display specific information about the files. You can read about these using the man command from section 4.2.
The chmod command is used to change permissions on a file. Permissions are indicated as follows,
-rwxrwxrwxwhere r means the file is readable, w means the file is writable and x means the file is executable. The first three permissions are for the owner, the second three are for the group and the last three are for everyone else. There are eight possible combinations for each set of rwx.
| Octal | Binary | Permissions | |
| 0 | 000 | none | |
| 1 | 001 | --x | |
| 2 | 010 | -w- | |
| 3 | 011 | -wx | |
| 4 | 100 | r-- | |
| 5 | 101 | r-x | |
| 6 | 110 | rw- | |
| 7 | 111 | rwx | |
Thus
rcf1537-6% chmod 721 setacct
will set the permissions on the file setacct to
-rwx-w---x
The rm command is used to remove (delete) files. It is very easy to use. Simply type: rm filename where filename is the name of the file that you want to delete. Later on, you will learn how to use wildcards (*) to operate on more than one file at a time. With rm this can be very risky - you can easily delete additional files unintentionally. Be extremely careful whenever using this command with a wildcard.
A safer alternative to the rm command is del . This will force the computer to ask you to confirm any file deletions. For example, suppose you have a file called paper1.tex that you want to remove. If you enter rm paper1.tex at the shark10% prompt, the computer will remove the file. But if you enter del paper1.tex instead, the screen will print
rm: remove paper1.tex (y/n)?You now answer y or n and hit return. Using del takes a bit longer, but is safer.
The cp command copies one file to another name or another place. For example:
rcf1537-6% cp intro.tex oldintro.tex
This will copy the file intro.tex to a new file named oldintro.tex while keeping intro.tex exactly as it was. These two files will be identical except for their name. It is a good idea to use cp to make ``backup'' versions of files to prevent accidental destruction.
Often you want to copy a file from one directory to another. In this case, you have to include the location of the file as part of the file name. Suppose, for example, you wish to copy the file algebra.tex from your account to a subdirectory called papers. You would type
rcf1537-6s% cp algebra.tex papers/newname
where newname is the new name you choose for the file in the new location. If newname is . (a single period), the new copy will have the same name as the original.
If you wish to move the location of a file, or change its name, you
would use the mv command. This works just like the cp
command, but it does not leave the old file - it creates a new file
with the same contents and removes the old file.
cat and more-Typing Files
The cat command types out the contents of a file. This command is very useful for typing out small files or piping the contents of large files to other commands. It is invoked by giving the filename as an argument:
rcf1537-6% cat intro.tex
This is the contents of the file intro.tex
This is the second line.
This is the third line.
.
.
.
This is the last line.
rcf1537-6%
There is another command, more, that can also be used to type out the contents of files. There are a few advantages to using more. The more command will stop when the listing fills up the screen, and display ``-More- (x%)'' (x being the percentage of how far you are into the listing). The command will wait for you to press the spacebar before it continues listing the file. It can also ``search'' for specific characters in the file so that you may start and end your listing at any point. To get help on more you can use man, or you can type an h when you see the ``-More-'' prompt at the bottom of the screen.
Editors are used to create and edit files. Choosing an editor can be a difficult matter because computer users have very strong preferences towards a their favorite editor. In general, every editor has advantages and disadvantages, and you should choose the editor that best suits your own needs. Many people learn more than one editor so that they can use the best one for the particular task at hand.
The RCF supports several Unix editors, vi and ed, as well
as GNU EMACS. vi is a screen-based editor that comes
standard on all Unix systems. It is fast, powerful, screen-oriented
but has a uniquely confounding command syntax. ed is a line-editor also
standard on Unix. It provides very good string matching and high
speed operation, but you can only see one line at a time (similar to
Xedit on the Cyber). GNU EMACS is a very flexible
screen editor. It is a free public-domain editor that can be found on
most Unix systems. It powerful, easy to use, and can be customized to
your own needs. This is the recommended editor at the RCF.
Documentation for all of these editors is available from the RCF.
Printing Information
If you know exactly which printer you wish to send you file to, you can use the lpr command as follows:
rcf1537-6% lpr -Pprintername filename
This will send the named file to the chosen printer. An even easier method is
to use a GUI on your desktop that displays your files. Once a file is displayed,
you can then send it to one of the printers displayed. You should be
aware that certain printers have certain uses and restrictions. This
information is available on-line (just type ``h'' when the computer asks
for a specific printer), but it is included here also. The RCF Printers
are listed in the table below.
printer name use location ----------------------------------------------------------------- laserjet-1537-BW-draft-duplex (default duplex mode) rm 1537 laserjet-1422-BW-draft (default duplex mode) rm 1422 phaser-1335AA-BW-draft rm 1335-AA phaser-1335AA-BW-pub rm 1335-AA phaser-1335AA-CLR-draft rm 1335-AA phaser-1335AA-CLR-pub rm 1335-AA phaser-1235A-BW-draft rm 1235-A phaser-1235A-BW-pub rm 1235-A phaser-1235A-CLR-draft rm 1235-A phaser-1235A-CLR-pub rm 1235-A phaser-1115A-BW-draft rm 1115-A phaser-1115A-BW-pub rm 1115-A
If you are curious to see if your job has been printed, or if you want
to know if there is a long line for a particular printer, you can use
the lpstat command. You can request different types of
printing status information using this command. The table below
summarizes some of the more useful options options for lpstat for Sun Solaris & lpq
for Linux.
You can read about more options in the man pages.
Some lpstat Options
| Option | Description | |
| -a | Show if a printer is accepting jobs | |
| -d | Show default destination | |
| -p | Show status of all printers | |
| -p printer-name | Show status of specific printer | |
| -u username | Show requests by username | |
For example,
rcf1537-6% lpstat -p printer or lpq -a
printer main is idle. enabled since Mon Jul 19 15:55:09 EDT 2002.
available.
Canceling A Print Job
You can use the cancel command to cancel a print request while it is still in the queue, or if it is being printed. In order to do this, you need to know the request ID. The request ID always includes the name of the printer, a hyphen, and the number of the print request. For example the request ID of a job sent to the main printer may be main-118696. The request ID is displayed after you submit the job. If you do not remember the number, type lpstat and press return. You may cancel more than one job at a time. The syntax is cancel requestID. For example,
rcf1537-6% cancel main-118696 on Sun Solaris or
lprm job # on Linux
request ``main-118696'' canceled
rcf1537-6%