© 2008 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.

U002: Introduction to Unix

U-002, Introduction to the Unix Operating System


CONTENTS


 
 
 

INTRODUCTION

This document is intended to help the new user of the computers that run a version of the Unix operating system. At UVa, Information Technology and Communication (ITC) has IBM RS/6000 servers (RS) that run a version of Unix called AIX, Sun workstations and servers that run SunOS or Solaris, and Silicon Graphics workstations that run IRIX.

The RS/6000 computers at UVa have ITC's Unix Menu System (Umenu) installed as the default configuration. (See document U-001A, "Using UVA's Unix Menu System" for more information on Umenu). If you prefer to work from the Unix prompt, you should disable the Umenu system by selecting "System Customization" from the main menu. The next time you log in, you will get the Unix prompt, from which the commands in this document can be issued. You can use the Umenu system at any time by typing umenu at the Unix prompt.

The command interpreter described in this document is the Korn shell, which acts as an interface between the user and the Unix system. The Korn shell is the default shell on ITC's Unix systems, so user commands are generally the same on each Unix machine. Any differences in a command among the machines will be noted in this document.

In order to include the information that a wide audience of users might want to know, this document has been packed full of information. There is probably more here than you will want to try to assimilate in one sitting. Try reading a section at a time and experimenting on your account as you work your way through the document. There may be some sections for which you currently have no use; skip them. They will still be there when you need them.


Things to Remember

  1. The Unix operating system is case-sensitive; i.e., a command in lower-case letters is interpreted differently from one in capital letters. ALWAYS turn off the Caps Lock key on your terminal or microcomputer before you log in. Enter all commands in lower-case letters unless otherwise instructed.
  2. Be sure to end everything that you type with a carriage return (marked Return). The Return key is shown as <CR> in this document. The computer doesn't know you are trying to tell it to do something until it sees a carriage return, so if the computer seems to be ignoring you, check to see if you forgot to press the carriage return.


GETTING STARTED

Connecting to a Unix Computer

(NOTE: If you will be using the X Window System, refer to document U-014 for login instructions.)

  1. If you are accessing a Unix machine from a system running MS-Windows (95/98 or NT):

    1. Select Start, then Run and issue the command telnet hostname, where hostname is the is the name of the host you want to connect to (typically blue.unix) and click OK. (If you have a telnet application other than the standard windows telnet you'll need to follow the instructions provided by the vendor for reaching a host.)
    Skip to the next section entitled "Logging In and Changing Your Password."

  2. If you are using a Macintosh that is connected to the UVa network and running the Macintosh Finder, follow the steps below.

    1. Turn the computer on.
    2. Find the icon or picture labeled NCSA Telnet (or just Telnet). (You may or may not have to log in to an AppleTalk server to find it.)
    3. Double click on that icon.
    4. Choose "Open connection" from the ``File'' pulldown menu.
    5. Type the name of the computer on which you have an account in the box labeled "Host/Session Name."
    6. Click on the button labeled "Connect."'

    Skip to the next section entitled "Logging In and Changing Your Password."

  3. If you are dialing in to UVa, follow the instructions found on the
    ITCWeb "Dial-In Access" page.

    Skip to the next section entitled "Logging In and Changing Your Password."

  4. If you are logging in at the console of a workstation, the login message and prompt will already be on the screen. If not, press the Return key to refresh the screen. Continue with the login process outlined in the next section.


Logging In and Changing Your Password

You should now be looking at the computer's login prompt.

  1. In lower case (Unix is case-sensitive), type the login ID that was given to you; it will probably be your initials with an alphanumeric suffix.

  2. After you have typed your login ID, press the Return key.
    The system will respond with

                   Password:

    Enter the password you were given, followed by a carriage return.

  3. Once your password has been accepted, you will be asked to change it. Enter a new password with six to eight characters including at least one numeric or special character. The system will let you know if the password does not meet our security requirements. You will be asked to enter the password twice for typing verification. Once this process is complete, you will see a welcoming message.

    Choosing a password that provides system security is important, not only to protect your files, but also to protect the entire system from being accessed by the mischievous or unscrupulous. Do not use your name or initials or any word that can be found in the dictionary. Putting a number in the place of a letter (the digit 1 for the letter l, for instance) is also not secure, nor is putting a digit at the beginning or end of a word or name. It is safer to use a sequence that is meaningful only to you or to use two words, omitting vowels and joined with a character such as a hyphen or comma.

    After changing your password, some users will see the message:

                   Enter terminal type [default is vt100]:

    The University's microcomputer facilities and many communications packages support vt100 terminal emulation. If you are not using one of UVa's computers, you may want to check your documentation to see what emulation is being used. However, in most cases, vt100 should work fine. Press the Return key to accept vt100 unless you are using some other terminal type (e.g. vt102, vt220, sun, adm5, tek4107, xterm), in which case you should type in the appropriate terminal type.

    Finally you will see the system's prompt. The prompt varies from machine to machine, but may include a $, which is the Korn shell's default prompt. New RS/6000 users will be presented with UVa's Umenu system. You will want to choose "Go to Unix" from the main menu in order to get a Unix prompt. (To disable Umenu, choose "System Customization" from the main menu.)

    The machine will now wait for you to enter a command.

  4. You can change your password at any time by typing:

                   passwd<CR>

    at a Unix prompt. The system will prompt you for your old password, then for your new password. Choose a password following the guidelines given in Step 3 above. You will be asked to enter it twice for typing verification.


Terminating a Command, Halting Screen Output and Logging Out

  1. Break Sequences to Terminate a Command

    If you want to stop a command before it completes execution, press the key sequence from the table below which is appropriate for the type of terminal you are using. This should return you to your initial prompt.

    Break Sequences
    Terminal Key(s)/Menu Sequence
    Host Explorer on Windows 95/98 or NTCtrl-c
    Telnet on Windows 95/98 or NTCtrl-c
    NCSA Mac Telnet on MacintoshCtrl-c or Network->Send "Interrupt process"
    RS/6000, Sun or SGI consoleCtrl-c

  2. Halting Screen Output

    If you want to temporarily halt output to your screen without terminating the execution of the command, enter Ctrl-s. Start output again by entering Ctrl-q. If you are on a microcomputer running

  3. Logging Out

    When you are ready to log out, type exit or press Ctrl-d.


FILES

The File System

Unix uses a hierarchical (or tree-structured) directory system to store files. A diagram of a portion of a file tree is shown below, with the directory /, called the "root" directory, at the top of the tree.

Unix file system structure

In the Unix system, all the commands you type, as well as peripheral devices such as disk and tape drives, can be specified as a path to a file. A path name can be absolute, meaning it begins with /, or relative to the directory where you are attached, called the current or working directory. Directory names are separated by additional slashes (e.g., /etc/passwd). In the figure above, some of the directories shown are:

NameDirectory Contents NameDirectory Contents
/binUnix utilities, such as
ls, cat, cp, cal,
spell, date, tee
, etc.
(described below)
/etcadministrative files
and directories, such
as the file "passwd"
which contains login
information for each
user account
/usradditional utilities/liblibraries, such as C
language and mathematics
libraries
/tmptemporary files; this
directory is cleaned
out periodically
/devperipheral devices,
such as disk drives and
terminals
/homeuser directories/uvalocally installed utilities

You will be assigned a directory with your login ID as its name when you are given an account. The user accounts reside in the /home directory. When you complete the login process, you will be attached at the directory /home/your-login-id in the file tree. Your login directory is called your HOME directory where HOME is one of the Unix system's shell variables. Shell variables are read by many Unix commands and can be given values either by the system or the user. For more information about shell variables, see "Tailoring Unix" below.

You can create other directories and files below your HOME directory as you need them. For instance, if your login ID is "abc3f," you may be assigned a HOME directory with the name /home/abc3f. If you create a directory named "docs", you could put all the chapters of your thesis in that directory. Then the full path of a file named "chap1.thesis" would be

               /home/abc3f/docs/chap1.thesis


Unix Command Syntax

The typical syntax of a Unix command is

               command arguments files

where the command options, also called arguments, are usually preceded by a hyphen (-). More than one file name may generally be given. Optional arguments will be surrounded by square brackets ([ ]) in the documentation on each command.

The table on the next page gives some commands and selected options that are useful for manipulating files and moving around in the file system, including how to list the contents of a directory (ls), the contents of a file (cat) and how to move from directory to directory (cd). To get complete information on each command and all its options, use man command to view the on-line documentation. The syntax is:

               man command

 
Table of File Commands
CommandMeaningResult
cat filename(s)catenatelist contents of filename(s) to the screen,
one after the other
cd directorychange directorychange working directory to directory;
if directory is omitted, changes to your HOME directory
cp file1 file2copymake a new copy of file1 called file2
diff file1 file2difference list the differences between file1 and
file2
find dir -name file -printfindfind files beginning search at directory
dir matching file and print the entire
pathname
grep [-i] string file(s)global regular
expression processor
search file(s) for string and list
path and line if found; use -i option
to ignore case of string
head filename(s) list first ten lines of filename(s)
ls [-AlpsCF]list return a list of the files in
the current directory (see example below)

-A all entries, including files beginning with period (.)
-l long format
-p put slash (/) after directories
-s give size in kilobytes (or blocks, SGI
    and Solaris)
-C multi-column listing (with short
    format)
-F put slash (/) after directories, asterisk (*) after executables

mkdir dirmake directorycreate a new directory named dir
more filename(s) list contents of filename(s) a
screenful at a time; scroll
forward with the space bar, back
with b, end with q or Ctrl-c.
mv name1 name2moverename file name1 to become
name2 or move a file name1 to
directory name2
page filename(s) same as more
pwdprint working directorylist the pathname of the working
(current) directory
rm [-i]removedelete a file; the -i option queries
for y or n response; default n
(do not delete)
rmdir directoryremove directorydelete directory;
directory must be empty
tail filename(s) list last ten lines of filename(s)
tee filename(s) input to tee is sent to both
filename and standard output
wc filename(s)word countlist the number of lines, words
and characters in filename(s)


The ls Command

Sample output from the command ls -Al is shown below (use ls -Alg on Solaris), with column numbers at the top for reference with the explanation following.

       1        2      3      4     5         6        7            8
   _________________________________________________________________________

   -rm-r--r--   1    abc3f   usr   4193     Jun 10   10:11    .history
   -rw-r--r--   1    abc3f   usr    626     Jun  6   12:08    .kshrc
   -rw-r--r--   1    abc3f   usr    338     Mar 17   16:43    .mailrc
   -rw-r--r--   1    abc3f   usr   9156     Nov  9   13:06    .newsrc
   -rw-r--r--   1    abc3f   usr    800     Jun  6   14:28    .profile
   -rw-r--r--   1    abc3f   usr   1424     Jun  6   14:28    .variables.ksh
   drwxr-xr-x   2    abc3f   usr    144     Jun  9   16:21    News
   drwxr-xr-x   4    abc3f   usr    144     Apr 16   14:34    docs
   drwxr-xr-x   2    abc3f   usr     64     Jun  3   10:34    fortran_progs
   -rw-r--r--   1    abc3f   usr   3289     Nov  9   10:09    junk


Column 1: Ten characters giving file information; first character (-, l or d) is type of file; remaining nine are permissions.

The first entry will generally be one of the following:

d = directory
l = symbolic link to a file
- = ordinary file

The next nine characters specify the file permissions given to user abc3f (first three characters), the group to which abc3f belongs (next three), and the other users on the system (last three). At UVa, the group to which the user belongs will generally be the same as all other users. On the RS/6000s and Sun/Solaris, it is possible to give a selected group of users permissions to a file; see Appendix C, "Setting File Permissions with Access Control Lists."

The permission characters are as follows:

r for read
w for write
x for execute
- for permission denied

If all permissions are given for a file, these entries would be

rwxrwxrwx

which gives the user, group and other read, write and execute permissions. For more information, see the section "Setting File Permissions with chmod."

Column 2: links; for a file, this is the number of links to the file (see the man page on ln to read more about links); for a directory, it is the number of directories it is in (its parent and itself) plus the directories under it.

Column 3: owner of file.

Column 4: group to which owner belongs.

Column 5: number of bytes (characters) in the file.

Column 6: date file was last modified.

Column 7: time file was last modified.

Column 8: file name.


Setting File Permissions with chmod

One way to set the permissions on files and directories is with the chmod command. The command syntax is as follows:

               chmod mode filename

where

               mode         is a string of users and permissions.
               filename   is the name of the file whose permissions are to be changed.

The example shown below gives mode as a string defined to be who_permission where who is

           u = user          (abc3f in the example above)
           g = group         (usr in the example above)
           o = other
           a = all (default)

and

           + = gives permission
           - = denies permission

and permission is

           r = read
           w = write
           x = execute

Example 1: You want to remove read permission on a file named "personal" from everyone except you. Use the command:

               chmod go-r personal

Example 2: You want to make a command file called "printit" readable and executable by everyone. Use the command:

               chmod ugo+rx printit     or     chmod a+rx printit

On the RS/6000s and Suns, you can give permissions to a selected group of users. See Appendix C, "Setting File Permissions with Access Control Lists."


Some Special Characters

Some characters have special meaning to the Unix system's Korn shell interpreter. These can be used so that you do not need to type long names of directories and files, or they can be used to "wildcard" (match more than one) directory and file name. Some of these characters are defined below.

File Expansion CharactersExplanation
.Current directory
..Parent of current directory
~/The system will expand ~ before / to
the HOME directory of the user.
~login_IDThe system will expand ~ before a login_ID to
the HOME directory of login_ID, using
information from the /etc/passwd file.
*Matches 0 or more characters; does not
match a leading period (.)
?Matches any single character
[...]Matches one character in a specification where
... can be a range (e.g., a-z, 0-9) or
a list (e.g. aeiouy) or a combination of both
(e.g., aeiouy0-9 matches any vowel or digit).


INPUT/OUTPUT AND REDIRECTION

One of the features provided by the Unix operating system is the ability to redirect output from a command to a file or to another command. Some of the characters used for redirection by the Korn shell are:

Redirection CharacterUse
>Write output from a command to a file
>>Append output from a command to a file
<Read input to a command from a file
|Send ("pipe") output from one
command to another

Combining redirection characters with the files called standard input (the keyboard, file descriptor 0) and standard output (the screen, file descriptor 1), standard error (file descriptor 2), and the command tee, you will have the tools and symbols you need to make use of redirection. Study the examples below to get some ideas.

  1. To use electronic mail to send a letter you have prepared with an editor and saved as a file called "welcome.letter" to xyz3g@virginia.edu:

                   mail xyz3g@virginia.edu <welcome.letter

  2. To send all the FORTRAN compiler error messages to a file called "errors" rather than have them come to the screen:

                   xlf myprog.f 2>errors

  3. To send the output from the ls command to the file "ls.output" rather than to the screen:

                   ls >ls.output

  4. To join "file1" and "file2", send the output to the sort command and then put the sorted output into a file called "sorted.big.file":

                   cat file1 file2 | sort >sorted.big.file

  5. To sort another file and append the output to "sorted.big.file":

                   sort file3 >>sorted.big.file

  6. To send output from the sort command both to a file "new.file" and to the screen:

                   sort filename | tee new.file

 
 
 
 
 
 


TAILORING UNIX

Special Files

It is possible to customize your Unix environment by editing the appropriate files. You can change the names of commands as well as specify which command options are selected. Some commands, like mail and trn (a USENET news reader), check for a specific file, often called a reconfiguration file (notice the letters "rc" at the end of many filenames) from which they get initialization information.

The following are some of the reconfiguration files you may see when you issue the ls -A command.

.profile used by the Korn shell to set the user's environment at login (see below)
.variables.ksh    used by ITC to set values for shell variables
.kshrc sets user's command aliases, if specified (see below)
.history stores commands you have issued (see below)
.mailrc sets electronic mail environment and mail aliases (see U-010, U-010A)
.forward forwards electronic mail to another address (see U-010)
.newsrc sets USENET news subscriptions (trn or rn command, see U-011)
.joverc initializes JOVE editor (see U-003)
.exrc initializes Vi editor, if specified (see U-004)

Default .profile, .mailrc, .joverc, .variables.ksh and .kshrc files exist, but you can create your own versions of these files to set your initialization preferences. The .history file is created automatically by the Korn shell and the .newsrc file is created by the trn program. You can look at and modify any of these files except the .history file, which is not a text file. More information follows on the .profile, .variables.ksh, .kshrc and .history files, but first it will be useful to know more about Unix shell variables.


Shell Variables

The Korn shell sets up some variables called shell variables which are read by Unix commands. One way that the Unix environment can be tailored is to change the values of these variables. A complete list of the shell variables set up by the Korn shell can be found on the ksh man page.

A shell variable (also called an environment variable) is usually written in upper-case letters (remember that Unix is case-sensitive) and its value is often a pathname to a directory or file. Many Unix commands read the value of one or more Unix shell variables when they execute. For example, full screen editors like JOVE or Vi need to know the type of display you are using, so they read the value of the TERM shell variable to get the information needed for full-screen display.

Some shell variables are described below.

EDITORname of editor you use
ENV specifies file to be executed at shell invocation;
good place for command aliases
EXINIT string value to set initial specifications for editor Vi
HISTFILE name of file in which commands are stored (default is .history)
HISTSIZE number of commands stored (default is 128)
HOME default is current directory when you log in; e.g., /home/abc3f
MAILCHECK    time in seconds for system to check for new mail
PATH search path used to find executable files (commands)
PRINTER default network printer
PS1prompt
RNINIT string value to set initial specifications for trn program
TERM type of terminal you are using

The PATH shell variable has special importance since it names the directories (separated by colons) that the system will search in for commands you type. The directories are searched in order from left to right. For example, if you invoke the ls command by typing the complete path /bin/ls, the value of PATH would not be used since there is a / in the command. However, if you type ls, the system searches the directories given in the PATH variable. The first executable file named "ls" found in one of the PATH directories will be executed. If no file is found, the error message ksh: ls: not found will appear.

To see the current value of the PATH, issue the command:

               echo $PATH

The directory specified by "." represents the current directory.

If you create your own executable command files (e.g., C programs or Unix shell scripts), you could put them in a "bin" directory in your HOME directory. To get the system to search that directory, set your PATH value to

               PATH=${HOME}/bin:${PATH}

which will cause the system to search your bin directory before searching other directories.

To see the current values of shell variables, issue the command set.

 
 
 

Sample .profile and .variables.ksh Files

When you log in to a Unix system at UVa, either the file named .profile (or .login for C shell users) or the file named .xinitrc will be run. The .xinitrc file is run if you log in using an X terminal. Each startup file will run other files (e.g. .variables.ksh or .xinitrc.ksh), which contain settings for the shell variables. You can modify these files to your preferences. Some sample files are shown below. These and other sample files are available for copying from the directory /help/unix/account.customization. Note that when a variable is preceded by a dollar sign ($), the current value of that variable will be used.

Sample .profile file
Sample .variables.ksh File


After changing your .variables.ksh file, you can activate it by executing it with the command

               . ./.variables.ksh

(This is done automatically if you logout and then log back in.)

Sample .kshrc File

The Korn shell provides the user with command aliasing, which is a way to rename a command along with your favorite options to a name of your choice. The ENV variable in the .variables.ksh file specifies the file $HOME/.kshrc. This means that the commands in $HOME/.kshrc will be read at each invocation of ksh.

Sample .kshrc File

ek /PRE>

To see the current aliases, issue the command alias with no parameters To execute a new or modified .kshrc file, use the command

               . ./.kshrc

(This is done automatically if you logout and then log back in.)

To remove an alias from the current terminal session, use the command:

               unalias name


HOW TO USE COMMAND HISTORY

The Korn shell stores the commands you enter in a file named .history. There are two ways to make use of the .history file to re-execute commands you have previously typed.

  1. First method: Enter the command

                   history

    which will produce a list of the sixteen most recent commands you have issued. When you locate the command you want to re-execute, note the number of the command, and enter

                   r command-number

  2. Second method: This method gives you the opportunity to edit your previous command.

    For Vi Users: Put set -o vi in your .variables.ksh. Then when you enter <ESC> (the escape key on your keyboard) followed by the letter k, the most recent command you have executed will appear on the command line. Repeating the letter k will present each command in the .history file in the order from the most recent. You are going up in the file. By typing the letter j , you can go down in the file, provided you are not at the most recent command. The letter h moves the cursor one character to the left on the command line; the letter l moves the cursor one character to the right. The arrow keys do not work.
    For JOVE Users: Put set -o emacs in your .variables.ksh file. (NOTE: jove is not recognized as a command-line editor.) To retrieve commands, use Ctrl-p to bring back the most recently executed command. After you have brought back at least one command, you can use the Control key with various letters to move in different directions: Ctrl-n to get the next command, Ctlr-f to go to the right and Ctrl-b to go to the left.

    For either editor: Once you have found the command you want to execute, you can edit it using some of the standard commands for the editor you use. See the ksh man page for a complete list of command-line editor commands. When you have finished editing, enter a Return to execute the command.


JOB CONTROL

Background Jobs

To run any Unix command in the background so that you can continue other work at your terminal, append an ampersand (&) to the command. You will immediately be returned to the system prompt so that you can issue other commands. The command jobs will show you the status of your background jobs.

If you log out before the process has finished, it will be killed. To avoid this, precede the command with nohup (no hangup). Its complete syntax is

               nohup command and arguments &

If that fails, try

               ksh

               nohup command and arguments &

               exit

If your command contains a pipe (|), issuing the command above will not work. Put the command into a file, make the file executable using chmod, hen use its filename in place of command and arguments.

To lower the priority of your background jobs, use the nice command described in the table below. You can also specify a time to run your job using the at command. See the man pages on nice and at for more information and usage examples.

Finally, if you forget to put a lengthy job in the background, Korn shell users can enter Ctrl-z to suspend the job. Then enter bg to put the job in the background; you will then get the system prompt so that you can do other work on the computer. Similarly, if one of your background jobs seems to be running excessively and you suspect it has gone awry, issue the jobs command to get the job number, then regain control of it by putting it into the foreground with fg %job_number. Then you can terminate the job with Ctrl-c if you want.


Terminating Runaway Processes

Occasionally you may lose keyboard control of your terminal. If this happens, go to another terminal and log on to the same computer you were logged on to when you lost control. Issue the command:

               ps -fu login_id (RS6000, SGI, Solaris)
                    or
               ps -ux | grep login_id (SunOS)

The screen (on an RS) for user abc3f with a runaway session might look similar to the figure shown below.

       UID    PID   PPID   C  STIME    TTY    TIME  CMD
       abc3f 34983 23462   0   May 08 pts/28  0:00  -ksh
       abc3f 43708 41403   0 15:51:47 pts/24  0:00  -ksh
       abc3f 54257 43708  40 16:07:52 pts/24  0:00  ps -fu abc3f

Each login session can be identified by a line ending in "-ksh." The current session will be the one associated with the ps command (PID and PPID 43708 in the listing above); therefore, the runaway session above has PID 34983. Terminate the session by issuing the command

               kill -9 34983


 
 
 

Job Control Command Summary

CommandResult
echo command_file | at timerun command_file at specified time
atqlist all at jobs belonging to user (for SGI use at -l)
atrm idremove at job with id (for SGI use at -r id)
bg [%job_number]Put job_number in the background; default is
that has been suspended with Ctrl-z.
Ctrl-zsuspend current job
fg %job_numberput job_number in the foreground
jobslist background jobs
kill -6 processIDSends kill signal to process number processID,
which is determined by issuing ps command.
Gives the process a chance to exit cleanly.
kill -9 processIDTerminates process number processID, which is
determined by issuing ps command. Use with discretion.
nice commandRun command at lower priority;
use for CPU-intensive programs.
nohup commandNo hang-up; use to keep a background job from
terminating at logout.
ps [-eflu] or ps [x]lists running processes (RS, SGI, Solaris)
-e show all processes
-f full listing / show user ID
-l long listing
-uuser-id
show processes owned by user-id
x show processes with no controlling terminal (RS6000)
ps [-alux]lists running processes (SunOS)
-a show all processes
-l long listing
-u show user ID / full listing
-x show processes with no controlling terminal

As mentioned before, you can get complete information on the above commands by using the man command. For job control commands specific to the Korn shell (ksh) interface, type

               man ksh

for more information.


HOW TO GET HELP

The best sources of information (in addition to this document, of course) are:

On the RS/6000s, there is an InfoExplorer program from which documentation and other help can be obtained. You can run InfoExplorer by just typing info. If you are on a terminal that runs the X Window System, you may need to issue the following commands from an X window:

               xhost full-RS/6000-name

This will grant access to your display to any user on the RS/6000 specified.

               rlogin full-RS/6000-name

Complete the login process on the remote RS/6000. Then enter:

               TERM=xterm
               DISPLAY=full-name-of-machine-running-X:0

To begin the InfoExplorer, enter the command:

               info


Appendix A: Printing Commands

The following chart includes some of the ways to send your output to a printer. As for most Unix commands, output from a command can be sent directly to a printer by using the "pipe" to redirect the output, bypassing the need to place output into a file before printing it.

For example, you could send the output from the ls command directly to a printer with the command:

               ls | lpr

This is assuming that you have your PRINTER environment variable set. You can set your PRINTER environment variable in your .variables.ksh with PRINTER=printer_name. Workstations in the Unix labs are set to print to the printers in the labs (unless you specify a PRINTER or use the -P option, as shown below).

Printing CommandsResult
enscript filenamesend to Apple LaserWriter printer; many formatting
options are available; see man page for
complete information.
lpq -Pprinterlist print jobs for printer.
lpr -Pprintersend files to printer.
lprm job_idcancel print job job_id which is obtained
from the lpq command.
manpage commandsend a copy of the manual page to default printer;
printer can be specified with -Pprinter_name
man printersreturn names and locations of public printers
on UVa's network.


Appendix B: Some Utility Commands

Utility CommandsResult
cal month yearreturn a calendar for month (digit 1-12)
and year (4 digits)
calendarread a file named "calendar" in your HOME
directory containing dates and events; system
sends daily reminders for current dates via
electronic mail
cut (-clist filename | -flist filename)return list of columns or fields from filename
datereturn date and time of day
dfdisk free; return available disk space in
kilobytes (Sun) or i-nodes and kilobytes (RS/6000)
du directorydisk usage; return number of blocks used by directory
expand filenamereplace each tab character in filename with spaces
file filenameshow the type of a file (e.g., ascii,
directory, data, C program, etc.)
fingerreturn information on machine users
man [-k] commandreturn a copy of the manual page for command;
with -k, does a keyword search
paste file1 file2concatenate corresponding lines of file1 and
file2 by joining them with a tab character
namtest machinereturn IP address of machine (RS/6000, Sun)
rlogin machinelog in to remote Unix machine
script filenamecopy all subsequent screen output to
filename; type exit to end scripting
sort filenamesort filename in ascending order;
many options available
spell filenamereturn misspelled words
sttyreturn terminal status; can be used to
modify terminal options
wreturn who is doing what on the system
whence commandsearch all the directories given in the PATH
environment variable for the first occurance
of command (Korn shell)
wholist who is logged on to the system
whois stringreturn information from UVa's database


Appendix C: Setting File Permissions with Access Control Lists

NOTE: Access Control Lists are not available on the Unix cluster blue.unix.virginia.edu. Please look at the documentation for the Unix cluster for alternatives.

On the RS/6000 computers and Suns running Solaris, there is an additional method for setting file permissions using an Access Control List. This method is useful to give file permissions to a specified group of users.

For example, if a research project leader (user "abc3f") has a file named "research.part1" located in his HOME directory to which he wants several others to have write permission, he could follow these steps:

Step 1: Make the HOME directory searchable by other users with the command:

               chmod a+x ~

Step 2: Take away all permissions on "research.part1" from other users by issuing the following command:

               chmod og-rwx research.part1

Step 3: (AIX only) Give the list of research collaborators read and write permission on the file by issuing the command:

               acledit research.part1

The acledit command uses the default editor for the system, or reads the value of the EDITOR shell variable set by the user. A screen similar to the one below will appear:

                   attributes:
                        base permissions
                           owner(abc3f):  rw-
                           group(usr):  ---
                           others:  ---
                        extended permissions
                           disabled

Using editor commands, change the word under extended permissions from disabled to enabled and then add lines to make the file similar to the one below:

                attributes:
                      base permissions
                         owner(abc3f):  rw-
                         group(usr):  ---
                         others:  ---
                      extended permissions
                         enabled
                         permit   rw-     u:login_1
                         permit   rw-     u:login_2
                         permit   rw-     u:login_3

where the actual login IDs for the research collaborators appear where login_1, login_2 and login_3 appear above. Exit the editor in the usual way.

Step 4: The acledit command will prompt with

           Should the modified ACL be applied? (y)

Answer with y or n as appropriate and the process is complete. Now the three collaborators can access the file.

Step 5: To give the same access control list to another file, say "research.part2," issue the following command:

               aclget research.part1 | aclput research.part2

and all the permissions that are on "research.part1" will be copied to the file "research.part2."

For more information, see pages 364ff of AIX General Concepts and Procedures for the IBM RISC System/6000 and the man pages for the commands acledit, aclget and aclput.


 
 
 
WE REALLY WANT TO KNOW...
Have you found this publication useful? Are there ways we might improve or supplement it or other ITC publications? Did you find this document in Web or in hard copy? We really want your opinion. Send e-mail to:  newsdesk@virginia.edu