UNIX for Beginning Users Developed by: User Liaison Section, D-7131 Denver Office [Name and Phone number deleted at authors Request] Revision Date: September 16, 1991 I. INTRODUCTION A. Audience This course is for individuals who will be using the UNIX operating system on a Reclamation computer platform. It is assumed that the student has a general understanding of data processing concepts. B. Course Objectives Upon successful completion of this course the student will be able to: 1. Demonstrate a knowledge of basic UNIX ideas. 2. Recognize the different types of files and the file structure. 3. Log in and out of UNIX using an interactive terminal. 4. Change the password and be aware of other responsibilities of owning an account. 5. Demonstrate a knowledge of where to get help. 6. Use the appropriate UNIX commands to display/print files, copy/move files, change file access permissions, create/delete directories, and change the current working directory. 7. Transfer a file to another computer platform using File Transfer Protocol (FTP). Use FTP commands to do the following: initialize FTP, establish connection, local computer commands, remote computer commands, close connection, exit FTP, help command, and special functions. 8. Use an editor to create files, input text, insert/replace text, copy/move text, and exit/save changes. 9. Use the mail utility to send/receive/delete messages 10. Use basic Annex commands to reestablish connection to a disconnected process. C. Course Handout Conventions There are several conventions used in this handout for consistency and easier interpretation: 1. Samples of actual terminal sessions are single-lined boxed. 2. User entries are shown in bold print and are underlined. QUIT 3. All keyboard functions in the text will be bold. (Ret) Backspace Tab Ctrl-F6 Print (Shift-F7) Go to DOS (1) NOTE: (Ret) indicates the Return or Enter key located above the right Shift key. 4. Examples of user entries not showing the computer's response are in dotted-lined boxes. 5. Command formats are double-lined boxed. 6. Three dots either in vertical or horizontal alignment mean continuation or that data is missing from the diagram. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ ³ ³ Multimax, Nanobus, and UMAX are trademarks of ³ ³ Encore Computer Corporation ³ ³ ³ ³ ³ ³ Annex is a trademark of XYLOGICS, Inc ³ ³ ³ ³ ³ ³ UNIX and Teletype are registered trademarks of ³ ³ AT&T Bell Laboratories ³ ³ ³ ³ ³ ³ Ethernet is a trademark of Xerox Corporation ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 1. BASIC UNIX IDEAS The UNIX operating system is a set of programs that act as a link between the computer and the user. The programs that allocate the system resources and coordinate all the details of the computer's internals is called the operating system or kernel. Users communicate with the kernel through a program known as the shell. The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel. Here is a basic block diagram of a UNIX system. Spread Sheet Compilers Calculators ³ ³ ³ V V ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ The Shell ³ Mail and ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³<- Message Inventory ³ ³ UNIX system kernel ³ ³ Facilities Control --->³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ Systems ³ ³ ³ ³ ³ ³<- Interpreters ³ ³ ³ Hardware ³ ³ ³ Formatters ->³ ³ ³ ³ ³ ³<- DBMS ³ ³ ³ ³ ³ ³ Calendar ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ ³ Word Systems ---->³ ³ ³ ³<- Processors ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ Editors ---->³ ³<- FTP ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The designers of UNIX used the following Maxims while writing the new operating system. 1. Make each program do one thing well. These simple programs would be called "tools." 2. Expect the output of every program to be the input to another program. 3. Don't stop building new "tools" to do a job. The library of tools should keep increasing. 1.1 The UNIX System The main concept that unites all versions of UNIX is the following four basics: Kernel The kernel is the heart of the operating system. It schedules tasks and manages data storage. The user rarely interfaces with the kernel directly. This is the memory resident portion of the operating system. Shell The shell is the utility that processes your requests. When you type in a command at your terminal, the shell interprets the command and calls the program that you want. The shell will support multiple users, multiple tasks, and multiple interfaces to itself. The shell uses standard syntax for all commands. There are two popular shells currently available, the BourneShell (standard System V UNIX) and the CShell (BSD UNIX). Because separate users can use different shells at the same time, the system can appear different to different users. There is another shell known as the KornShell (named after its designer), which is popular with programmers. This ability to provide a customized user interface is one of the most powerful features of UNIX. Commands and Utilities Separate utilities can be easily combined to customize function and output. They are flexible, adaptable, portable, and modular. They use pipes and filters. There are over 200 standard commands plus numerous others provided through 3rd party software. Files and Directories The directory system supports a multilevel hierarchy. Files and directories have access protection. Files and directories are accessed through pathnames. Files support multiple name links. Removable filesystems are also supported. 1.2 File Structure All data in UNIX is organized into files. All files are organized into directories. These directories are organized into a tree-like structure called the filesystem. The following diagram describes the top level organization of the UNIX filesystem: / (root) ³ ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÁÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄ¿ ³ ³ ³ ³ ³ ³ ³ bin dev etc lib tmp usr users These directories, in turn, are also organized hierarchically. For example: / ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ dev etc usr ³ ³ ³ ÚÄÄÄÁÄÄ¿ ÚÄÄÄÁÄÄ¿ ÚÄÄÄÄÄÄÄÄÂÄÄÁÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ ³ ³ ³ ³ dsk rmt init.d rc0.d mail adm spool ³ ÚÄÄÄÁÄÄÄ¿ ³ ³ acct sa In this example, dev, etc, usr, and adm are directories. Directories contain other files or directories. Plain files contain text or binary data and contain no information about other files or directories. Users can make use of this same structure to organize their files. For example: / ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ bin users dev ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ bsmith sjones ³ ³ ÚÄÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÁÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ ³ ³ memos progs physics chem history ³ ³ ³ ³ ³ ÚÄÄÁÄÄ¿ ÚÄÄÁÄÄÄ¿ ÚÄÄÁÄÄÄ¿ ÚÄÄÁÄÄ¿ ÚÁÄÄ¿ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ mfg eng c f77 mods calcs forms notes loc anc Every file has a name. A filename is composed of one to fourteen characters. Although you can use almost any character in a filename, you will avoid confusion if you choose characters from the following list. 1. upper case letters [A-Z] 2. lower case letters [a-z] 3. numbers [0-9] 4. underscore [_] 5. period [.] 6. comma [,] The only exception is the root directory, which always uses the symbol /. No other directory or file can use this symbol. Like children of one parent, no two files in the same directory can have the same name. Files in different directories, like children of different parents, can have the same name. The filenames you choose should mean something. Too often, a directory is filled with important files with names like foobar, wombat, and junk. A meaningless name won't help you recall the contents of a file. Use filenames that are descriptive of the contents. 1.3 UNIX System Files In order for you to have a basic understanding of the contents of some of the system directories, here is a partial list of those directories and what files they contain: /bin This is where the executable files are located. They are available to all user. /dev These are device drivers. /etc Supervisor directory commands, configuration files, disk configuration files, reboot files, valid user lists, groups, ethernet, hosts, where to send critical messages. /lib compiler libraries /tmp scratch processes, editors, compilers, and databases /bsd Berkeley commands /mnt empty, used for disks /stand boot information /lost+found orphans go here (look here after system crash) /unix* executable, bootable kernel This is not an exhaustive list of directories that contain system information but it is intended to remove some of the mystery behind these directories and the types of files they contain. 1.4 Command Line Syntax Users enter commands at the shell prompt. The default BourneShell prompt is the dollar sign ($). In general, the shell expects to see the following syntax: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: command options arguments º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Command - This is the UNIX command. Sometimes the command is representative of the function. For example, the command to list the contents of a directory is ls. The first and third letters of the word "list" are used. Unfortunately, this is not always the case. Options - These are also known as flags. The common form is: -A where A is the abbreviation of the optional function of the command. For example, the command ls lists the contents of a directory, while the command ls -l provides a long listing and ls -C provides output in columns. Several options can be combined following one '-'; for example -CF, or they can be entered separately as -C -F. Arguments - These can be file names, user names, or qualifiers to the command or one of its options. Example: ................................................................. . $ls -CF sjones . ................................................................. The UNIX command is ls list contents of directory the dash (-) indicates the options. C = Multiple-column output with entries sorted down the columns F = Put a slash (/) after each filename if that file is a directory and put an asterisk (*) after each filename that is executable. sjones = name of the directory to list (it can be a relative or absolute pathname) Example: ................................................................. . $diff memo1 memo2 . ................................................................. diff - differential file comparator command memo1 - filename argument memo2 - filename argument This command will tell what lines must be changed in two files to bring them into agreement. Here is another example that doesn't fit the general syntax for UNIX commands. Example: ................................................................. . $find . -atime +7 -print . ................................................................. find - find files . - the current working directory -atime - True if the file has been accessed in n days (n is the +7) -print - always true; causes the current path name to be printed So, this command will give a listing of all files in your current working directory that have been accessed in the past seven days. Some commands have several options and/or arguments; while others, like passwd and mail, are interactive and will prompt the user for additional input. 1.5 Correcting Mistakes Because the shell and most other utilities do not interpret the command line (or other text) until you press the (Ret) key, you can correct typing mistakes before you press (Ret). There are two ways to correct typing mistakes. You can erase one character at a time, or you can back up to the beginning of the command line in one step. After you press (Ret), it is too late to make a correction. 1.5.1 Erasing Characters When entering characters from the keyboard, you can backspace up to and over a mistake by pressing the erase key (#) one time for each character you wish to delete. The # will appear on the screen, and the character preceding it will be discounted. Example: ................................................................. . $ls phajne#y . ................................................................. In this example, the e will be ignored and ls phajny is sent to the Multimax. Multiple typos can be erased; simply press one # for each character to be erased. The erase key will back up as many characters as you wish, but it will not back up past the beginning of the line. 1.5.2 Deleting an Entire Line You can delete an entire line you are entering any time before you press (Ret) by pressing the kill key (@). When you press the @ (kill key), the cursor moves down to the next line and all the way to the left. The shell doesn't give you another prompt, but it is as though the cursor is following a prompt. The operating system does not remove the line with the mistake but instead ignores it. Now enter the command (or text) again from the start. 1.5.3 Aborting Program Execution Sometimes you may want to terminate a running program. UNIX might be performing a listing that is too long to display on your screen or for some other reason you want to terminate execution. To terminate program execution press the Delete key. The operating system sends a terminal interrupt signal to the shell. When the shell receives this signal, it displays a prompt and waits for another command. 1.5.4 Controlling Output to the Screen There are several ways to control the flow of characters to the screen as a result of executing a command. Such as: Ctrl-S - This keyboard function command will suspend the flow of characters to the screen as the result of executing a command. The screen will not continue until the keyboard function to resume output is given. Ctrl-Q - This keyboard function command will resume the output to the screen. Hold Screen - If your terminal has this key (i.e. VT200), you can press it once to stop output to the screen. To resume output to the screen, press the key again. Denver BOR MULTIMAX Each BOR Multimax 310 has four 15 Megahertz National Semiconductor 32-bit processors with 64 kilobytes of cache memory rated at 2 million instructions per second (MIPS) for a total of 8 MIPS. The main memory consists of 32 megabytes (million bytes). There can be a maximum of 14 disk drives. Each drive has a capacity of 600 megabytes for a total capacity of 8.4 gigabytes (a gigabyte is one thousand million bytes) Connection to the Multimax is accomplished through one of several methods. Access is made through TCP/IP based Annex terminal servers. The two Annex II servers have 32 ports each and the Annex I has 16 ports. The Annex II servers will allow up to 64 users access to the two Multimax computers. The Annex I is used for access to the on-line printers. CDCnet and TELNET are other ways to gain access to the Multimaxes. Printouts are handled on a 600-line-per-minute line printer and a 10-page-per-minute laser printer. Each Multimax has a hardcopy terminal and a CRT to serve as an operator console. There are two tape drives capable of 1600 or 6250 bits per inch (bpi) on each system. There is also a cassette tape drive. Software available are FORTRAN, COBOL, C, and UNISOL (an accounting package). The database management system is INGRES by Relational Technology, Inc. PROCOMM+ will be the communication interface with IBM PC's and compatibles. The operating system for the Multimax is UMAX V. UMAX V is the name for the Encore implementation of UNIX System V. 1.6 Logging on the Annex This sample session shows how the login process is displayed on the terminal screen and is uniform for all users. To bring the standard menu onto the screen, press the Space Bar. If you are using a PC, first start PROCOMM+. Then when you are in the Terminal-Mode Screen, press the Space Bar; and the MICOM menu will appear. NOTE: Login procedures from the regions are included in the back of this manual Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ WELCOME TO THE B.O.R. NETWORK P/S:B ³ ³ SYSTEMS PRESENTLY AVAILABLE ARE: ³ ³ ³ ³ **SYSTEM** **NAME** ³ ³ ³ ³ VAX 8300'S VAX ³ ³ CYBER/CDCNET F.E. CDC ³ ³ ENCORE/UNIX MAX ³ ³ OUT DIAL OD ³ ³ ³ ³ TO SELECT A SYSTEM, ENTER THE SYSTEM ³ ³ NAME AND CARRIAGE RETURN AT NEXT ³ ³ PROMPT. ³ ³ ³ ³ CHANNEL 08/061. ENTER RESOURCE MAX ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ MAX is the resource name you must enter to be connected to the Annex, which is the Multimax front end processor. Some MICOM menus might not have the MAX selection; in this case, enter MAX to select the Annex. This is the same as if the menu showed the option. After entering MAX you will see something similar to the following: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ CONNECTED TO 06/011 ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This indicates that you are connected to the port selector. Wait two seconds, press (Ret) twice, and the annex prompt will appear after a warning message. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ Annex Command Line Interpreter * Copyright 1988 Xylogics, Inc. ³ ³ ³ ³ ***WARNING***Unauthorized access to U.S. Government computers ³ ³ is punishable by fine and/or imprisonment. ***WARNING*** ³ ³ annex: ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 1.7 Logging on the Multimax To establish a connection between the Annex and the Multimax enter the following command at the Annex prompt: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: rlogin º º º º host - name of the Multimax º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ The Denver Multimaxes have been assigned the names domax0 and domax1. The names stand for the Denver Office Multimax System 0 and 1. The domax0 is used for production of Bureau-wide applications. The domax1 is used for training and application development and it is the one to use for exercises associated with this course. To enter domax1 type: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ annex:rlogin domax1 ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ or ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ annex:r domax1 ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ NOTE: Abbreviations are allowed for the Annex commands, the only requirement is to type in enough characters to make it unique. When the Annex has opened communications with the selected host, the following prompt will appear: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ login: ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ To connect with the host, enter your login name at the prompt. Your login name is assigned to you by the system administrator and typically will be your first initial and last name, all one word with no spaces. Only 8 characters are allowed for the username so extra letters will be truncated. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ login:rharding ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Once the login name has been accepted, the next prompt will be for the password. The following prompt will appear on the screen. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Password: ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Enter your password. For security reasons, the host will not display your password as you type it. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Password: secret ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Once you have entered the correct password. The login procedure will continue and the following will appear on the monitor screen. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ UNIX System V Release ax.2.2o ns32332 ³ ³ domax1 ³ ³ Copyright (c) 1984 AT&T ³ ³ All Rights Reserved ³ ³ ***WARNING***Unauthorized access to/use of this U.S. Government ³ ³ computer is punishable by fine and/or imprisonment. ***WARNING***³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ At this point you are successfully signed on to the Multimax. The dollar sign ($) is the default prompt for the BourneShell. 1.8 Logging Off the Multimax At the shell prompt $, you can logout of the Multimax using one of the following methods: 1. Enter the keyboard function command Ctrl-D. 2. Type the UNIX command exit. Once you have entered the command to logout the following will appear on the screen: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $exit ³ ³ CLI: Connection closed. ³ ³ annex: ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Once you are back at the Annex prompt, you can establish another connection or logout of the Annex. 1.9 Logging Off the Annex When the Annex prompt (annex:) appears, you can enter the command to logout of the Annex. The command to logout of the Annex is as follows: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: hangup º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ There is a 60 minute inactivity timeout programmed into the Annex; however, it is a waste of resources if you don't enter hangup. When you are finished with your session, be sure to enter hangup at the annex: prompt. If you don't type anything for 60 minutes, the Annex will log you out of the system and display the following message: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ *** Annex Port Reset Due to Inactivity Timeout *** ³ ³ ³ ³ Annex Command Line Interpreter ³ ³ DISCONNECTED ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ When the hangup command has been entered, the following will appear on the screen: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ annex: hangup ³ ³ ³ ³ Resetting line and disconnecting. ³ ³ ³ ³ ³ ³ Annex Command Line Interpreter * Copyright 1988 Xylogics ³ ³ annex: ³ ³ DISCONNECTED ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 1.10 Changing the Password The following command will change the password. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: passwd º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ You will be prompted to enter the existing password (this question is skipped if you don't have a password). Next you will be prompted to enter the new password. You will then be asked to enter the new password again. This will verify that you have not made a typographical error. If the two entries are the same, the password will be changed. The new password must meet the following criteria: NOTE: Some of these items are configurable by the system administrator and these reflect the settings for the Denver Multimax only. 1. Each password must have at least six characters. Only the first eight characters are significant. 2. Each password must contain at least two alphabetic characters and at least one numeric or special character. Alphabetic characters can be upper or lower case. 3. Each password must differ from the login name and any reverse or circular shift of that login name. For comparison purposes, an upper case letter and its corresponding lower case letter are equivalent. 4. A new password must differ from the old by at least three characters. For comparison purposes, an upper case letter and its corresponding lower case character are equivalent. Passwords on the Multimax have a thirteen-week expiration period. At the end of the thirteen weeks, you will be required to change your password. Once you have changed the password, you cannot change it again for two weeks. This prevents you from immediately changing back to the old password and eliminates a possible security violation. If you try to change the password before two weeks have passed since the last change, a warning message will be displayed. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $passwd ³ ³ Changing password for teacher ³ ³ Old password: secret ³ ³ Sorry: < 2 weeks since the last change ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ NOTE: This is about as friendly as UMAX will ever get. Try to choose a password that is not easy for someone else to guess. The increasing number of computer crimes involving thefts all point to a need for protecting the system from unauthorized access. Do not use words like your birthdate, telephone number, spouse's name, child's name, etc. for passwords. Although you may think passwords are an unnecessary nuisance, they are an important way to strengthen the security of the computer system. 1.11 On-line Manual The major source of on-line help is in the form of documentation known as the on-line manual pages. The pages are divided into eight sections. Section 1 contains entries for UMAX user commands; the other sections describe administrative tools, library functions, games, and internal system structure and calls. To gain access to the on-line manual pages enter the following command: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: man º º º º command - the UNIX command you want information about º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ NOTE: The name 'man' stands for manual. Example: ................................................................. . $man ls . ................................................................. This command will display the on-line manual pages for the ls command. The on-line manual pages entry begins with the command name and a one line summary followed by a synopsis of the command line syntax. Optional flags and arguments are enclosed by square brackets []. A detailed description of the command and all of its options and arguments follow the synopsis. The description can include helpful examples. At the conclusion of the entry, related files and commands are listed. NOTE: Most on-line manual pages will fill more than one screen. Be sure to control the output to your screen. 1.12 who and finger Commands Once you have logged onto the Multimax, you can find out who is logged on the system with the following commands: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍË º Command Format: who [options] º º º º options - see man pages for a complete list º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ The default output (no options) of the who command lists the user's login name, terminal line, and the time that the user logged in. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $who ³ ³ jwheeler ttyp0 Aug 15 10:26 ³ ³ mvlsdba rt02190 Aug 15 09:25 ³ ³ teacher rt020b0 Aug 15 11:07 ³ ³ eholderf rt021c0 Aug 15 11:03 ³ ³ dbowman rt01150 Aug 15 08:58 ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Options will display other information about the users that are currently logged onto the system. Some items available are the amount of time that has elapsed since activity occurred on that line, the process identifier (PID) of the login process, comments, and exit information. A UNIX command that provides a little more information about users that are logged in the system is the finger command. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: finger [options] [user1] º º º º options - see on line manual for complete list º º º º user1 - login name º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ The finger command with no options will list the login name, full name, terminal name, write status (an asterisk (*) before the terminal name indicates that write permission is denied), idle time, login time, office location, and phone number (if known) for each user that is currently logged in the system. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $finger ³ ³ Login Name TTY Idle When Office ³ ³ Jwheeler Jim Wheeler ttyp0 16 Wed 10:26 MP ³ ³ mvlsdba Motor Veh Lic rt02190 16 Wed 09:25 d7160 ³ ³ teacher Teacher Acct *rt020b0 Wed 11:07 ³ ³ eholderf Eileen Holder rt021c0 1 Wed 11:03 ³ ³ dbowman Dale Bowman rt01150 Wed 08:58 ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Workshop 1 This workshop will reinforce your understanding of the ideas presented in Chapter 1. Each student is to complete the entire workshop. DESK EXERCISES 1. What two organizations first developed UNIX? 2. In what high level programming language is UNIX written? 3. What are some characteristics of UNIX? 4. What is Encore Computer Corporations implementation of UNIX called? 5. What part of UNIX controls the details of the computer's internal operations? 6. What part of UNIX allows the user to communicate with the computer? Continue on the next page 7. What is the name of the tree-like structure under which all data is stored? 8. What is the name of the highest level directory? 9. What symbol represents the highest level directory? 10. What is the general syntax of a UNIX command? 11. What is the most common form for listing options on a command line? 12. What character would you use to erase a character on the command line? 13. What character terminates the execution of a command? 14. What is the default BourneShell prompt? 15. How can you control the flow of output to your monitor screen? 1. What annex command is entered to make a connection to the Multimax? 2. What is the UNIX command to change the password? 3. How long is your password valid? 4. How long do you have to wait before changing your password again? Why? 5. What UNIX command is used to logout of the Multimax? 6. What is the command to logout of the annex? COMPUTER EXERCISES 7. Login to the Multimax a. What did you notice when you entered the password? b. Can you see the password as you enter it? c. What happens if you make a mistake while entering the password? 8. What do you see once you have logged in? Write it here. 9. Enter the command which displays the man pages for the man command. (Don't forget to control output to the screen.) The first section is titled "NAME," what are the titles of the other sections? 10. What are the options for the man command? 11. Enter the command to find out who (hint) is logged into the system. 12. What command will give you more information about the current users? Try it. 13. Logout of the Multimax and the Annex. 2. FILES In UNIX, all data is organized in files. An ordinary file is a memo, source code program or shell script. A shell script or program source code can be viewed or edited from your terminal. Other files contain binary data, like programs for the kernel; these files cannot be viewed or edited on the terminal. Peripheral devices such as disks, tape drives, printers, and terminals are also assigned file names. Device files are considered to be special files. They have 'special' characteristics. Although input and output can be redirected to and from a special file, do not attempt to display the contents of a special file on your terminal. 3.1 File Access Modes File access modes are the protections that can be assigned to files. This protection can protect your files from unauthorized reading or writing. You can even protect your files from yourself (you can prevent accidental deletion). There are three access modes for files: r (read) read, examine, copy data in a file w (write) modify, delete a file x (execute) use the file as a command Users with access to a file fall into one of three groups: u (user) the file's owner g (group) users in the same group o (other) everybody else The first output field of the ls -l command is a ten character field. Characters two through ten describe the file access modes. A typical access mode listing looks like: rwxr-xr-x Of the nine columns, the first three describe modes for the file's owner, the next three for his group, and the last three for everyone else. Within each group of three, the first column describes read access mode, the second write, and the third execute. A letter in a column indicates access granted, a dash (-) indicates access denied. Using the previous example, the user has r (read), w (write), and x (execute) permissions. Members of the user's logical group can read (r) or execute (x). Everyone else has read (r) and execute (x) permissions, too. The effect of these permissions is that the file's owner is the only one who can modify the file; but everyone can examine, copy, or execute the file. To change access modes on a file or directory, use the chmod command. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: chmod º º º º access - access permissions º º file1[filen] - one or more files to change permissions º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Access can be expressed in either of two forms: - with letters: [ugo] [+-=] [rwx] - with numbers: [0-7] [0-7] [0-7] Let's look at the method of changing the file permissions with letters. The letters u, g, and o represent user, group, and others, respectively. The + (plus) sign means to add the permission and the - (minus) sign means to remove the permission. The = (equal) sign means to set the permissions as shown. Of course, r,w, and x are read, write, and execute. If, for illustration purposes, we created a file named file1 that had the following permissions: rw-rwxrwx and you want to give yourself (user) execute permission and take away others' (others' here means group and everyone else) write permissions. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $chmod u+x,g-w,o-w file1 ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Now if we use the ls -la command, and look at the file permissions for file1, they will look like this: rwxr-xr-x If you want to set several protections at once use the equal sign. The following example will set the permissions for the user to read and execute. Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $chmod u=rx file1 ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The second method of changing the permissions is to use the octal digits (0-7). The octal digits 0 through 7 are represented in binary in the following manner. Octal Binary Corresponds to permissions 0 000 --- 1 001 --x 2 010 -w- 3 011 -wx 4 100 r-- 5 101 r-x 6 110 rw- 7 111 rwx Notice that every time a one digit (1) occurs in the binary number the corresponding permissions are also set. Every time a zero (0) occurs, the corresponding permission is denied. So to change the file permissions in the previous example, this is the command to enter: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $chmod 755 file1 ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The first octal digit assigns user permissions of read, write and execute. The second digit assigns the group permission to read and execute. The last digit sets the others permission to read and execute too. 3.2 Listing Contents of Directories The ls command is used to display file names and their characteristics. Since file names are stored in directories, ls actually reads directory files. Executing ls with no flags or arguments simply lists the names of the files that exist in your current working directory. The initialization files will not be listed. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: ls [options] [dir1[dirn]] º º º º options - see man pages for a complete list º º º º dir1[dirn] - one or more directory names º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ The -a flag will cause the hidden (initialization) and all other filenames to be displayed. The -C flag causes the output to be changed from single-column to multi-column display. The -F flag adds a character to the end of each displayed filename: / indicates a directory * indicates the file is executable. blank indicates a plain or ordinary file The -l flag causes detailed information to be printed for files in the directory. This information includes: file type (directory, block special, character special, fifo special, symbolic link, or ordinary file) access modes number of links ownership group affiliation size in bytes date and time of last modification filename Without a filename argument, ls displays information about the current working directory. The output is automatically sorted alphabetically by default. Example: ................................................................. . $ls . ................................................................. The following example provides a long listing of the current working directory. Example: ................................................................. . $ls -l . ................................................................. This example shows the ls command with no arguments so it uses the default, the current working directory. The argument could be a relative or absolute directory name. Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ls -la ³ ³ total 975 ³ ³ drwxrwxr-x 4 teacher class 2048 Jul 16 17.56 . ³ ³ drwxr-xr-x 60 root 1536 Jul 13 14:18 .. ³ ³ -rwx------ 1 teacher class 4210 May 1 08:27 .profile ³ ³ -rwxr-xr-x 1 teacher class 1948 May 12 13:42 memo ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 3.3 File Classifications The file command will classify files according to their contents. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: file [options] º º º º file1[filen] - one or more filenames to analyze º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ A few of the classifications that the file command displays are shown below. The results of using the file command are not always correct. English text ascii text c program text cannot stat commands text data directory empty executable Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $file speople ³ ³ speople: commands text ³ ³ $file test ³ ³ test: directory ³ ³ $file mail ³ ³ mail: data ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ By convention, files beginning with a dot (.) are called initialization files or 'hidden files'. These files describe your environment to the shell. They are sometimes called 'dot files'. By convention, files that end with: .c are C source code programs .f are Fortran source code programs .o are object programs .a are archive files 3.4 Displaying Files The cat command displays the contents of a file. The command cat is an abbreviation for catenate. This command will read each file in sequence and write it to the monitor screen. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: cat [options] [file1[filen]] º º º º options - see man pages for a complete list º º º º file1[filen] - one or more file names º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ If no filename is given, or the argument - is encountered, cat reads from standard input. Sample session: ................................................................. . $cat . ................................................................. This is the simpliest example but not very exciting. The cat command will get its input from the keyboard. Everything that is typed will be displayed on the monitor. If an argument is given to the cat command that file will be displayed on the monitor. Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $cat main.c ³ ³ main () ³ ³ { ³ ³ printf ("hello from main!\n\n"); ³ ³ printf ("calling function1!\n\n"); ³ ³ funct1(); ³ ³ printf ("back from function1!\n\n"); ³ ³ printf ("calling function2!\n\n"); ³ ³ funct2(); ³ ³ printf ("that's it!\n\n"); ³ ³ } ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Several files can be displayed on the monitor one after the other by separating the filenames with a space. Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $cat main.c main.f ³ ³ main () ³ ³ { ³ ³ printf ("hello from main!\n\n"); ³ ³ printf ("calling function1!\n\n"); ³ ³ funct1(); ³ ³ printf ("back from function1!\n\n"); ³ ³ printf ("calling function2!\n\n"); ³ ³ funct2(); ³ ³ printf ("that's it!\n\n"); ³ ³ } ³ ³ program calling ³ ³ write(6,100) ³ ³ 100 format('Hello from main!',/) ³ ³ write(6,110) ³ ³ 110 format(' Calling subroutine1!',/) ³ ³ call sub1 ³ ³ write(6,120) ³ ³ 120 format(t15' Back from subroutine1!',/) ³ ³ write(6,130) ³ ³ 130 format(' Calling subroutine2!',/) ³ ³ call sub2 ³ ³ write(6,140) ³ ³ 140 format(t15' Back from subroutine2!',/) ³ ³ write(6,150) ³ ³ 150 format(' Thats all, folks!') ³ ³ end ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ If the file contains more lines than can be displayed on the screen the display will continue to scroll until the last line has been displayed then the prompt will be redisplayed. This can be a problem if you intend to read the text. Be prepared to stop the screen so it can be read. The pg command displays the contents of a file one screen at a time. It allows the user to perform string searches and to scroll backwards. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: pg [options] [file1[filen]] º º º º options - see man pages for a complete list º º º º file1[filen] - one or more files to paginate º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ $pg memo ³ ³ What's Happening ³ ³ by Pam Hajny ³ ³ Denver Office ³ ³ ³ ³ With IRM Training: ³ ³ ³ . A Reclamation-wide workshop was held in early October to . . . . . ³ three groups; CYBER, VAX, and other (PC/LAN, scientific, ³ ³ : ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Twenty three lines of the file will appear and the : (colon) prompt will appear on the last line. To have the next twenty three line of the file appear, simply press (Ret). If you don't want to see anymore of the file, enter a q (for quit) and the shell prompt will be redisplayed. The following UNIX command is useful for viewing the end of a file without having to display the entire file. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: tail [options] [file1] º º º º options - see man pages for a complete list º º º º file1 - the file to display, if none is given use º º standard input º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ The tail command displays the last 10 lines of file by default. The tail command accepts a -N flag to display the last N lines. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $tail memo ³ ³ data communication between the ASC IBM and other Reclamation computers. ³ ³ Asynchronous communication can be accomplished with the same terminals ³ ³ we use for other computer tasks, over the same lines and through the MICOM ³ ³ port selectors. Currently, host-to-host communications is accomplished ³ ³ over a line between the IBM and the CYBERs. The software that supports ³ ³ this communication is called NJEF. Although the capability has been there ³ ³ for some time, we have recently been working with ASC personnel to ³ ³ improve its reliability and accessibility. For CYBER users, there is ³ ³ an NJEF Users' Guide available which can be requested through the Hotline ³ ³ (303) 236-4567. ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 3.5 Removing Files The rm command will remove the entries for one or more files from a directory. If an entry was the last link to the file, the file will be destroyed. Removal of a file requires write permission to the directory itself, but neither read nor write permission to the file itself. The format for the rm command is: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: rm [options] º º º º options - see man pages for a complete list º º º º file1[filen] - one or more files to remove º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ls ³ ³ memo ³ ³ tdata ³ ³ subdir ³ ³ $rm memo ³ ³ $ls ³ ³ tdata ³ ³ subdir ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The file memo has been deleted from the current working directory. Multiple files can be deleted by separating the filenames with a space. Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ls ³ ³ memo ³ ³ tdata ³ ³ subdir ³ ³ $rm memo tdata ³ ³ $ls ³ ³ subdir ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 3.6 Printing Files The lp command routes a file to a printer. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: lp [-d] [-n] [file1[filen]] º º º º dest - destination (default set by administrator) º º º º number - number of copies (default is 1) º º º º file1[filen] - one or more files to be printed º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ If no file name is mentioned the standard input is assumed. The filename dash (-) stands for standard input and may be supplied in conjunction with named files. The order in which the filenames appear is the order in which they will be printed. The printers in Denver have the following destination names: Mannesman 910 laser printer - mtlzr Mannesman 600 line printer - mt_600 (Denver default) If no specific printer is given the default printer will be selected. The following example will print one copy (default) of the file called test_285 to the line printer (default). Sample session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $lp test_285 ³ ³ request id is mt_600-1271 (1 file) ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ It is possible to specify the printer as shown in the following example. In this case, we specified the default printer. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $lp -dmt_600 test_286 ³ ³ request id is mt_600-1272 (1 file) ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ To print two copies of a file called test_287 on the laser printer in Building 53 in Denver, enter the following command: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $lp -dmtlzr -n2 test_287 ³ ³ request id is mtlzr-1273 (1 file) ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 3.7 Print Status The lpstat command will print information about the current status of the printer system. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: lpstat [options] º º º º options - see man pages for a complete list º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ If no options are given, the lpstat command will print the status of all requests made to lp by the user. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $lpstat ³ ³ mtlzr-1274 teacher 22560 Jul 16 09:05 on mtlzr ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The first field is the remote id of the print job. The username is next and the size (in bytes) of the print file. The date and time are next and finally the name of the printer. One of the options available is -t. This option will print all of the printer status information. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $lpstat -t ³ ³ scheduler is running ³ ³ system default destination: mt_600 ³ ³ device for mt_600: /dev/rlp000 ³ ³ device for mtlzr: /dev/rt0002 ³ ³ mt_600 accepting requests since Sep 19 16:09 ³ ³ mtlzr accepting requests since Sep 19 16:43 ³ ³ printer mt_600 is idle. enabled since Jul 3 16:52 ³ ³ printer mtlzr is idle. enabled since Jul 3 16:51 ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This is an example of the kinds of information available from the lpstat command. 3.8 Canceling Print Jobs The cancel command will cancel printer requests made by the lp command. The command line arguments can be either request id's (these are returned by the lp command) or the printer name. If you specify the request id, the cancel command will stop the job even if it is currently printing. If you specify the printer name, the job currently being printed will be canceled. In either case, the cancellation of a request that is currently printing will free the printer to print the next request. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: cancel <[ids] [printer]> º º º º ids - request ids (returned by lp command) º º º º printer - printer name º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $lp -dmt_600 contest ³ ³ request id is mt_600-1280 (1 file) ³ ³ $cancel mt_600-1280 ³ ³ request "mt_600-1280" canceled ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ 3.9 Copying Files A user may make a copy of a file if he has read access to that file. The cp command can be used to copy the contents of one file to another. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: cp º º º º file1[filen] - one or more source files º º º º target - file or dirname º º º º file1 and target cannot be the same and º º if the target is a file its' contents are º º destroyed. º º º º If target is a directory, then the contents º º of the source file(s) is copied to that º º directory. º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $cp contest memo ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This will cause a copy of the file contest to be made into a file named memo. If memo doesn't exist, it will be created. If it already exists, it will be written over. The cp command is nondestructive; that means that the source file will remain intact. The cp command can also be used to copy several files into another directory. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $cp file1 file2 /user0/teacher ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ A copy of file1 and file2 has been sent to the directory (in this case, the target directory) /user0/teacher. The user of cp will own the newly copied files. 3.10 Moving Files A user may move a file only if he has write access to that file. The mv (move) command can be used to rename one file. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: mv º º º º file1[filen] - one or more source files º º º º target - file or dirname º º º º file1 and target cannot be the same and º º if the target is a file its' contents are º º destroyed. º º º º If target is a directory, then the contents º º of the source file(s) are moved to that º º directory. º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mv contest memo ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This will have the effect of changing the name of the file contest into memo. The permissions on the file will remain the same. The move command is destructive. That means the source file no longer exists. The mv command can also be use to move files from one directory to another. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mv file1 file2 /user0/teacher ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The files, file1 and file2, have been sent to the directory /user0/teacher. They have been "moved" and no longer reside in the current directory. The owner remains the same when a file is moved. Workshop 3 This workshop will reinforce your understanding of the topics presented in this chapter. Login to the Multimax using the username and password given to you by the instructor. Each student should complete the entire workshop. You might need to work in a team on the computer exercises. DESK EXERCISES 1. List four types of files. 2. What does the file command do? 3. The ls command will display the contents of the current working directory. What does the -F option do? 4. What command is used to display the contents of an ordinary file? 5. What command would you use to append one file to the end of another? 6. What is the lp command? Continue on the next page 7. How can you find out the status of your print job? 8. What command would you enter to cancel a print job called mt_600-1131? 9. What command will copy the contents of one file to another? 10. What does mv do? 11. What do the following file protections indicate? rwx------ rwxr-xr-x --------- rwxr--r-- Continue on the next page COMPUTER EXERCISES 12. Log into the Multimax. 13. Execute the file command on the files listed below. Record the output in the space provided. a. .profile b. /bin/vax c. /dev/console 14. Which of the above files is readable? 15. Enter the command to display the contents of the current working directory. Hint: ls a. How many files are listed? b. Type ls -a c. How many entries are listed? Continue on the next page d. Which entries were not listed in your original output of ls? 16. How does the output of ls -a and ls -Ac differ? Try it. 17. How many fields are displayed for each entry when you execute ls -l? What are the fields? 18. What are the current permissions on .profile? 19. Change permissions on .profile so that no one (including you) has any access to the file. (Hint: Use the chmod command) 20. Without changing the permissions, list the contents of the file named .profile to the screen. What happened? Why? Continue on the next page 21. Change the permissions on .profile to u - read, write, execute g - read o - read 22. Type cat .profile. What happened? Do you know why? 23. Enter pg memo. What does this command do? 24. Send one copy of the file called memo to the laser printer. 25. Logout of the Multimax and the Annex. NOTES ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ 4. DIRECTORIES A directory is a file whose sole job is to store file names and related information. All files, whether ordinary, special, or directory, are contained in directories. The directory in which you find yourself when you first login is called your home directory. You will be doing much of your work in your home directory and subdirectories that you'll be creating to organize your files. 4.1 Absolute/Relative Pathnames As we saw earlier, directories are arranged in a hierarchy with root (/) at the top. The position of any file within the hierarchy is described by its pathname. Elements of a pathname are separated by a /. A pathname is absolute if it is described in relation to root, so absolute pathnames always begin with a /. These are some example of absolute filenames. /etc/passwd /users/sjones/chem/notes /dev/rdsk/Os3 A pathname can also be relative to your current working directory. Relative pathnames never begin with /. Relative to user sjones' home directory, some pathnames might look like this: chem/notes personal/res To determine where you are within the filesystem hierarchy at any time, enter the command to print the current working directory. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: pwd º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $pwd ³ ³ /user0/teacher ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Notice that this is an absolute pathname. This is the pathname of the current working directory. 4.2 Creating Directories Directories are created by the following command: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: mkdir [options] º º º º options - see man pages for a complete list º º º º dirname - name of the new directory (absolute or º º relative pathname). º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ If the option to change permission mode is not given, the directory will have default permissions set to read,write,execute for the user and read and execute for group and others. The files . (dot) and .. (dot dot) are created automatically. In order to create a sub-directory, you must have write permission on the parent directory. The owner id and the group id are set to the real users id and group id, respectively. 4.3 Removing Directories Directories can be deleted using the rmdir command. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: rmdir [options] º º º º options - see man pages for a complete list º º º º dirname - the directory to remove, it must be empty. º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $pwd ³ ³ /user0/teacher ³ ³ $ls -la ³ ³ total 5 ³ ³ drwxr-xr-x 2 teacher class 512 Jul 18 08:12 . ³ ³ drwxrwxr-x 5 root root 2048 Jul 1 13:14 .. ³ ³ $rmdir teacher ³ ³ rmdir:teacher:Directory does not exist ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Normally, directories are deleted using the rmdir command. Before the directory can be removed, it must be empty; that is, it must not contain any files. Notice that in the above example two files are present, . (dot) and .. (dot). Remember, these refer to the current working directory and its parent. They cannot be removed. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $rmdir . ³ ³ rmdir: .: Can't remove current directory or .. ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ For the purposes of deleting a directory, the directory is empty if it contains only two files, namely . (dot) and .. (dot dot). 4.4 Changing Directories To "move around" in the filesystem, use the cd (change directory) command. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: cd [dirname] º º º º dirname - If not specified, the value of the $HOME º º shell variable will be used as the new º º current working directory. º º º º If the directory given is an absolute pathname º º that directory is the new current working º º directory. A relative pathname can also be º º given. º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $cd /user0/teacher ³ ³ $pwd ³ ³ /user0/teacher ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The current working directory is now /user0/teacher. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $cd memos ³ ³ $pwd ³ ³ /user0/teacher/memos ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This command will look for a subdirectory called memos under the current working directory. If it is found, it will become the new working directory; otherwise, an error will occur. Error messages beginning with "cannot access file..." often indicate that the pathname is incorrect or misspelled. 4.5 Renaming Directories The mv (move) command can also be used to rename a directory. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: mv º º º º dirname - name of the source directory º º target - target directory name º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mv users newusers ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This will have the effect of changing the name of the directory users into newusers. The permissions on the directory will remain the same. NOTE: All files and subdirectories in the directory newusers now have new absolute pathnames. 4.6 The directories . (dot) and .. (dot dot) The filename . (dot) represents the current working directory; and the filename .. (dot dot) represent the directory one level above the current working directory, often referred to as the parent directory. If we enter the command to show a listing of the current working directories files and use the -a option to list all the files and the -l option provides the long listing, this is the result. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ls -la ³ ³ total 975 ³ ³ drwxrwxr-x 4 teacher class 2048 Jul 16 17.56 . ³ ³ drwxr-xr-x 60 root 1536 Jul 13 14:18 .. ³ ³ ---------- 1 teacher class 4210 May 1 08:27 .profile ³ ³ -rwxr-xr-x 1 teacher class 1948 May 12 13:42 memo ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The ls -la command displays access modes, number of links, the owner, the group, size, etc. of files in a directory; but also displays the characteristics of the current working directory and its parent. The first entry is the entry for the current directory. The owner is teacher and the group is class. The second entry is the parent directory. It is one level up from the current working directory. It is owned by the root directory. Instead of asking for information on all of the files in a directory, you can request just the information on the current working directory. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ls -ld ³ ³ drwxrwxr-x 4 teacher class 2048 Jul 16 17:56 . ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The response from the command simply shows the long information for the current working directory . (dot). Information can also be obtained for the parent of the current working directory by using its name as an argument. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ls -ld .. ³ ³ drwxr-xr-x 60 root root 1536 Jul 13 14:18 .. ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Here's the long list of the current working directories parent. (.. is the shorthand representation of the current working directories parent) Both of the directory names . (dot) and .. (dot dot) can be used as arguments to commands. To change the parent of the current working directory into the current working directory, the command is: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $pwd ³ ³ /user0/teacher ³ ³ $cd .. ³ ³ $pwd ³ ³ /user0 ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The current working directory is the former parent. This is all very interesting but what good is it? You can specify the current working directory or its parent without typing the entire absolute pathname. It can also be handy when giving arguments to UNIX commands. Why are the pathnames sjones/chem and ./sjones/chem equivalent? 4.7 Directory Access Modes Directory access modes are listed and organized in the same manner as any other file. There are a few differences that need to be mentioned. 4.7.1 Read Access to a directory means that the user can read the contents. The user can look at the filenames inside the directory. 4.7.2 Write Access means that the user can add or delete files to the contents of the directory. 4.7.3 Execute Executing a directory doesn't really make a lot of sense so think of this as a traverse permission. This access allows the user to reference the directory name in a command. The reference is not necessarily explicit, since the shell deduces the absolute pathname of a command from the user's environment. For example, the shell knows that the full pathname of the ls command is /bin/ls. A user must have execute access to the bin directory in order to execute ls. If traverse permissions are denied, others cannot change to it or through it. Another user can't do a cd to the protected directory or any subdirectory beneath it. IN CLASS QUIZ ÚÄÄÄÄÄÄÄÄ¿ ³ / ³ ÀÄÄÄÄÂÄÄÄÙ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ ³ ³ ÚÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ³ bin ³ ³ tmp ³ ³ etc ³ ³ mnt ³ ³ l ³ ³ dev ³ ÀÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ÀÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ ³ ÚÄÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ³ Uni1 ³ ³ Uni2 ³ ³ Uni3 ³ ³ Uni4 ³ ÀÄÄÄÄÄÂÄÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ {1} ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ³ filea ³ ³ fileb ³ ³ Dira ³ ³ filea ³ ³ Filea ³ ³ file1 ³ ³ File2 ³ file3 ³{5} ³ Dir1 ³ ³ Dir2 ³ ÀÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÂÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÂÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ³ ³ ³ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÚÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÄÁÄÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ ³ filea ³ ³ Dirb ³ ³ fileb ³ {2} {3} ³ filea ³ ³ Filea ³ 6}³ File1a ³ ³ file1b ³ ³ Dir2a ³ ÀÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÂÄÄÄÄÙ ³ ³ Write the complete pathname for the 5. ________________________________ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÄÄÁÄÄÄÄÄÄ¿ {7} files numbered above. {4} ³ filea ³ ÚÄÄÄÄÁÄÄÄÄ¿ ÚÄÄÄÄÁÄÄÄÄ¿ 6. ________________________________ ÀÄÄÄÄÄÄÄÄÄÙ ³ File2aa ³ ³ file2ab ³ 1. _______________________________ 8. You are in /mnUni1 and want #1. ÀÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÙ 7. ________________________________ 2. _______________________________ ____________________________________ 3. _______________________________ Write the minimum pathname needed for 9. You are in /mnUni3/File2 and want #4 each of the following: 4. _______________________________ ____________________________________ 4.7.4 Typical Root Directory ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ ls -FC / ³ ³ ³ ³ ³ ³ Student/ bin/ lib/ stand/ u2/ user2/ ³ ³ ³ ³ Students/ bad/ lisp/ tmp/ unix* usr/ ³ ³ ³ ³ Support/ dev/ lost+found/ tmp.sh unix.bak* usr2/ ³ ³ ³ ³ etc/ mnt/ tmp1/ unix.test* usr3/ a.out* ³ ³ ³ ³ foo rel_notes tmp2/ user0/ install/ shlib/ ³ ³ ³ ³ u1/ user1/ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ NOTES ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ Workshop 4 This workshop will reinforce your understanding of the topics presented in this chapter. Login to the Multimax using the username and password from the previous workshop. All students should complete the entire workshop. You may need to work in a team on the computer exercises. DESK EXERCISES 1. What is a directory? 2. What is an absolute path name? 3. What is a relative path name? 4. What command will create a directory? 5. What command will remove a directory? 6. What command is used to change from one directory to another? 7. How would you change the name of a directory? Continue on the next page 8. What do the files . (dot) and .. (dot dot) represent? 9. What does execute permission on a directory mean? COMPUTER EXERCISES 10. Login to the Multimax. 11. What is the absolute pathname of your current working directory? Hint: pwd 12. Type cd etc What message do you get? Can you explain why? 13. Type cd /etc What is your current working directory? Why did this happen? 14. Enter the command that will return you to your home directory. Continue on the next page 15. Enter the command that will change to your current working directories parent. 16. List the contents of your current working directory 17. List the permissions, ownership, size, etc. of your current directories parent. 18. Enter the command to change to your home directory. Create a new subdirectory with a name of your choice. 19. Change the current working directory to the subdirectory you just created. 20. Rename the subdirectory to Student. Is this the same subdirectory as everyone else in the class? Why? 21. Change to your home directory and delete the subdirectory Student. 22. Logout of the Multimax and the Annex. NOTES ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ 5. COMMUNICATION UTILITIES This chapter will deal with the utilities that allow one user to communicate with another. Some of these utilities require the other user to be logged in and others do not. The mail utility can be used to send messages to one or more users. It is not necessary for the user that is receiving the message to be logged in. The mail utility delivers the message to a file belonging to the recipient. The user will be notified that a mail message exists. Messages can be saved or deleted and a reply sent. The talk utility is an interactive session that allows each user to send message simultaneously to each other. Both users must be currently logged in for this utility to work. The write utility is a one-way communication. It allows you to send a message to another user. The user must be logged in and no reply is possible. 5.1 Sending Electronic Mail The basic command line format for sending mail is: ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: mailx [options] [user1[usern]] º º º º options - see man pages for a complete list º º º º user1[usern] - one or more users to get the mail º º message º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ The username is the name assigned by the system administrator to a user on the UNIX system (for example, rharding). The username can also include a system name if the recipient is on another UNIX system that can communicate with the sender's (for example, sys2!rharding). Let's assume that the recipient is on the local UNIX system. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mailx rharding(Ret) ³ ³ Subject: ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Now enter the subject of your message followed by a (Ret). The cursor will appear on the next line. Simply start typing the message. There is no limit to the length of a message. When you have finished, send it by typing Ctrl-D on a new line. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mailx rharding(Ret) ³ ³ Subject: Work schedule(Ret) ³ ³ Please check the bulletin board(Ret) ³ ³ for the new work schedule.(Ret) ³ ³ Ctrl-D ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The shell prompt on the last line indicates that the message has been queued (placed in a waiting line) and will be sent. 5.2 Reading Mail To read your mail enter: Example: ................................................................. . $mailx . ................................................................. Executing this command places you in the command mode of mailx. If there are no mail messages waiting to be read, you will see the following message on the screen: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mailx ³ ³ No mail for teacher ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Of course, your username will appear instead of 'teacher'. When a mail message appears in the recipient's mailbox, the following message will appear on the screen. Example: ................................................................. . you have mail . ................................................................. This notice will appear when you login to the system or upon return to the shell from another procedure. When you have been notified of mail waiting to be read, enter the command to enter mail. The screen will look something like this: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mailx ³ ³ ³ ³ mailx version 3.1 Type ? for help. ³ ³ "/usr/mail/teacher": 3 messages 3 new ³ ³ >N 1 bhood Fri Jul 13 13:01 21/324 Review session³ ³ N 2 class2 Fri Jul 13 14:53 15/211 Meeting notice³ ³ N 3 phajny Fri Jul 13 16:53 11/272 Reorganization³ ³ ? ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This first line indicates the version of mailx that is being used. In this case, version 3.1. There is a reminder that help is available by typing the ?. The second line shows the path name of the file used as input (usually the same as the username) and a count of the total number of messages and their status. The messages are numbered in sequence with the latest one received on the bottom of the list. To the left of the sequence numbers, there may be a status indicator; N for new, U for unread. The > symbol points to the current message. The other fields in the header line show the login of the sender, day, date, and time it was delivered. The next field has the number of lines and characters in the message. The last field is the subject of the message; it might be blank. To read the mail messages you can do any of the following steps: (Ret) - This will cause the current message to be displayed. The current message is the once indicated by the > sign. p (Ret) - This is equivalent to pressing the (Ret) key with no argument. The current message will be displayed. p 2 (Ret) - You can press p (for print) or t (for type) followed by the message number(s). p teacher (Ret) - This will print all messages from user teacher. 5.3 Saving Mail All messages that are not specifically deleted are saved when quitting mailx. Messages that have been saved are placed in a file in the home directory called mbox. The mbox file is the default. It is possible to save them in a file of the users choice. Messages that have not been read are held in the mailbox. The command to save messages comes in two forms. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: S [msglist] º º º º msglist = º º º º n message number n the current message º º º º ^ the first undeleted message º º º º $ the last message º º º º * all messages º º º º n-m an inclusive range of message numbers º º º º user all messages from user º º º º /string All messages with string in the subject line º º (case is ignored) º º º º :c all messages of type c where c is: º º º º d - deleted messages º º n - new messages º º o - old messages º º r - read messages º º u - unread messages º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Messages specified by the msglist argument are saved in a file in the current directory named for the author of the first message in the list. If the username 'teacher' sent the message and you entered: Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ? S * ³ ³ "teacher" [New file] 11/268 ³ ³ ? ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The mail message has been saved into a file in your current directory called 'teacher'. If you want to save the file in another filename, you can do that with the second method of saving mail. Basically, it works the same as S; but it allows you to save the mail to a file you specify. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: s [msglist] [file1] º º º º msglist - same arguments as before º º º º file1 - filename which will receive the saved mail º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ 5.4 Deleting Mail To delete a message, enter a d at the command mode prompt followed by a msglist argument. An msglist argument can be any one the following: n message number n the current message ^ the first undeleted message $ the last message * all messages n-m an inclusive range of message numbers user all messages from user /string All messages with string in the subject line (case is ignored) :c all messages of type c where c is: d - deleted messages n - new messages o - old messages r - read messages u - unread messages For example, suppose you wanted to delete all of your mail messages. Enter the following command at the command mode prompt. The command mode prompt for mailx is the question mark (?). Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mailx ³ ³ ³ ³ mailx version 3.1 Type ? for help. ³ ³ "/usr/mail/teacher": 3 messages 3 new ³ ³ >N 1 bhood Fri Jul 13 13:01 21/324 Review session ³ ³ N 2 class2 Fri Jul 13 14:53 15/211 Meeting notice ³ ³ N 3 phajny Fri Jul 13 16:53 11/272 Reorganization ³ ³ ? d * ³ ³ ? q ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ All of the messages have now been deleted. The messages are not actually deleted until the mailbox is exited. Until that happens the u (for undelete) command is available. Once the quit command (q) is entered, however, the deleted messages are gone. 5.5 Undeliverable Mail If there has been an error in the recipient's username, the mail command will not be able to deliver the message. For example, let's say you misspelled the username. It will return the mail in a message that includes the system name and username of the sender and recipient. It also includes a message stating the reason for the failure. The sender of the message would get a message from mailx indicating that an error had occurred. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mailx ³ ³ ³ ³ mailx version 3.1 Type ? for help. ³ ³ "/usr/mail/teacher": 1 message 1 new ³ ³ >N 1 teacher Fri Jul 13 13:45 25/655 Returned mail:User unkno³ ³ ? ³ ³ Message 1: ³ ³ From teacher Fri Jul 13 13:45:57 1990 ³ ³ Received: by domax1.UUCP (5.51/) ³ ³ id AA01997; Fri, 13 Jul 90 13:45:54 mdt ³ ³ Date: Fri, 13 Jul 90 13:45:54 mdt ³ ³ From: Mail Delivery Subsystem ³ ³ Subject: Returned mail: User unknown ³ ³ Message-Id: <9007131945.AA01997@domax1.UUCP> ³ ³ To: teacher ³ ³ Status: R ³ ³ ³ ³ ----- Transcript of session follows ----- ³ ³ 550 snoopy... User unknown: No such file or directory ³ ³ ³ ³ ----- Unsent message follows ----- ³ ³ Received: by domax1.UUCP (5.51/) ³ ³ id AA01995; Fri, 13 Jul 90 13:45:54 mdt ³ ³ Date: Fri, 13 Jul 90 13:45:54 mdt ³ ³ From: Teacher Account D-7130 ³ ³ Message-Id: <9007131945.AA01995@domax1.UUCP> ³ ³ To: snoopy ³ ³ Subject: Meeting notice ³ ³ ³ ³ Meeting will be held at Charlie Brown's house. ³ ³ July 13, 1990 ³ ³ 7:30 p.m. ³ ³ ³ ³ ? ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The ? is the mailx command mode prompt. Mailx is asking for input. A list of commands available can be shown by entering a ?. Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ? ? ³ ³ mailx commands ³ ³ type [msglist] print messages ³ ³ next goto and type next message ³ ³ edit [msglist] edit messages ³ ³ from [msglist] give header lines of messages ³ ³ delete [msglist] delete messages ³ ³ undelete [msglist] restore deleted messages ³ ³ save [msglist] file append messages to file ³ ³ reply [message] reply to message, including all recipients ³ ³ Reply [msglist] reply to the authors of the messages ³ ³ preserve [msglist] preserve messages in mailbox ³ ³ mail user mail to specific user ³ ³ quit quit, preserving unread messages ³ ³ xit quit, preserving all messages ³ ³ header print page of active message headers ³ ³ ! shell escape ³ ³ cd [directory] chdir to directory or home if none given ³ ³ list list all commands (no explanations) ³ ³ top [msglist] print top 5 lines of messages ³ ³ z [-] display next [last] page of 10 headers ³ ³ ³ ³ [msglist] is optional and specifies messages by number, author, ³ ³ or type. ³ ³ The default is the current message. ³ ³ ? ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ This is a partial list of mailx commands available to you. We will not discuss all of them. If you are interested in the other features, you can use the on-line manual pages to find out how to use them. 5.6 Talk Utility Talk is a visual communication program which copies lines from one terminal to that of another user. This is similar to the phone utility on VMS. Once communication is established between two users, they can both type simultaneously with their output appearing in separate windows. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: talk [ttyname] º º º º user1 - If you are talking to someone on the same machine, º º then this is just the person's username. If º º you want to talk to a user on another host, then º º user1 is of the form: º º º º host!user or º º host.user or º º host:user or º º user@host º º º º user@host being preferred º º º º ttyname - If the person you want to talk to is logged on º º more than once, you can use the ttyname argument º º to indicate the terminal name. º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ For illustration, let's assume we want to talk with the user student on the same machine. The command is: Example originator: ................................................................. . $talk student . ................................................................. Example recipient: ................................................................. . Message from Talk_Daemon@domax1 at 17:36 ... . . talk: connection requested by teacher@domax1. . . talk: respond with: talk teacher@domax1 . ................................................................. When the recipient has typed in talk teacher@domax1, the following message will appear on the originators screen: Sample Session originator: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Connection established. ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The screen will be divided in half by a row of dash characters. The originator will type a message on the top half, and the same message will appear on the lower half of the screen on the recipient's screen. Likewise, everything the recipient types on the top of his screen the same message will appear on the bottom of the originators screen. Once this communication is established, the parties may type simultaneously with their output appearing in different windows. While in talk, Ctrl-L will cause the screen to be reprinted, and the erase and kill characters work as you would expect. Sample Session originator: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Hi Snoopy, ³ ³ Charlie Brown suggests we meet at noon today. ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³-------------------------------------------------------------- ³ ³ OK, but the billiard championship is in my house at 1 P.M. ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Sample session recipient: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ OK, but the billiard championship is in my house at 1 P.M. ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³-------------------------------------------------------------- ³ ³ Hi Snoopy, ³ ³ Charlie Brown suggests we meet at noon today. ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ When the communication is finished, the interrupt character will cause the talk utility to exit. Example: ................................................................. . [Connection closing. Exiting] . ................................................................. 5.7 Talk Permission Denied If you don't wish to have your work interrupted by a request to establish a talk connection, you can deny messages. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: mesg [-[n][y]] º º º º n - no, forbids messages via write by revoking non-user º º write permission on the user's terminal. º º º º y - yes, reinstates permission º º º º º º mesg with no arguments will report the current state º º without changing it. º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $mesg ³ ³ is y ³ ³ $mesg -n ³ ³ $mesg ³ ³ is n ³ ³ $mesg -y ³ ³ $mesg ³ ³ is y ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ The default permission is enabled. Some UNIX commands, however, disallow messages in order to prevent messy output. 5.8 Write Utility This command will write a message to the screen of another user. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Command Format: write [ttyname] º º º º user1 - username of the user º º º º ttyname - which terminal to send (i.e. tty00) º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Sample Session originator: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $write lucy ³ ³ Hello Lucy, ³ ³ What's the latest from the Psychology Department? ³ ³ (interrupt character) ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Sample Session recipient: ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ $ ³ ³ ³ ³ Message from teacher on domax1 (rt021d0) [ Thu Jul 19 13:43:12 ] .. ³ ³ Hello Lucy, ³ ³ What's the latest from the Psychology Department? ³ ³ ³ ³ ³ ³ $ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Here's a suggestion for using write to communicate a little easier. When the user first 'writes' to another user, wait for the recipient to 'write' back before starting to send. Both users should agree on a signal to indicate to the other person that they can reply. How about 'o' for over. The signal 'oo' could be used for "over and out," which would mean that the communication is finished. NOTES ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ Workshop 5 This workshop will reinforce your understanding of the topics covered in this chapter. Login to the Multimax with the username and password given to you by the instructor. Each student is to complete the entire workshop. Computer exercises might need to be worked as a team. DESK EXERCISES 1. What is the command to send an electronic mail message to another user on the Multimax? 2. Once you have entered the mail utility what command can you enter to get help? 3. What does the command d 5-9 accomplish? 4. What is the command to exit the mail utility and return to the UNIX system prompt? 5. What is the mailx command mode prompt? 6. How would you create a "talk" session to user Student2 on the host domax0? 7. What time does the billiard championship start? Continue on the next page 8. What UNIX command will prevent interruption of your work by someone wishing to "talk"? 9. Regarding "write", does the recipient need to be logged in? Regarding "talk", does the recipient need to be logged in? Continue on the next page COMPUTER EXERCISES 10. Login to the Multimax. 11. Send a mail message to another student in the class. How can you find out who is logged in? (who?) Does the recipient need to be logged in? 12. Send a mail message to username lucy. (lucy does not exist) What happened? Why? 13. Read your mail and save one message to the current working directory. Delete all other mail messages. Continue on the next page 14. Establish a talk connection with another student. 15. What UNIX command do you enter to deny permission for a talk connection? Try it! 16. Send a message to another student using the write command. How is this different from "talk?" 17. Logout of the Multimax and the Annex. 6. SHELL BASICS There have been several shells written for UNIX. They have different features and each is in use through out the world. The BourneShell is the accepted standard for System V UNIX. Another shell is called the Cshell, named for "C" which is the high-level programming language. Another shell is the KornShell; it is named after the person who developed it, David Korn. It has more features than the BourneShell and i