Using System Resources
??Bsd: redo format stuff; add caution that the format command
??Bsd: will destroy impt data on disks pg 227
 ************* BACK AND FORTH PAGING SUBROUTINE ************

PAGEFLOP

If they want to quit, do so
 If They want to quit subsession, Do SO!
  Decrement LOCAL and GLOBAL Page Counters

FORWARD

  Increment LOCAL and GLOBAL Page Counters
   *************** END PAGEFLOP *********************
  ****** CHAPTER INTERNAL SELECTOR ALGORITHM ******

SELECTOR

   Reset Local Page Counter

SELAGAIN

 CHECK IF ONLY A <CR>

WRONGSEL

YOUR SELECTION IS NOT IN THE 0 - #SELIMIT  RANGE  Please try again

GO


Copyright CourseWare Technologies Inc., 1985-88


Lesson - 6


 USING SYSTEM RESOURCES 

MENU

Using System Resources|Topics to Learn|6-0|8,50
     #                   Topic
    ---                 -------
     1   -    Introduction to System Resources
     2   -    How to Print Files
     3   -    Using Magnetic Disks
     4   -    Using Magnetic Tape
     5   -    The UNIX Mail System
     0   -    Return to Main Menu

TOPIC1

Introduction to System Resources

P1

Using System Resources|Introduction to System Resources|6-1.1|14,54
     As you recall, the integral components of your
computer system are the central processing unit (CPU), 
the primary memory, the disks drives, and the terminals.


     Besides the integral components, your UNIX
system is probably equipped with several other 
peripheral devices including:

       *  an off-line printer,
       *  one or two floppy disk drives,
       *  a magnetic and/or cartridge tape drive, or
       *  an optical disk, etc.          

P2

Using System Resources|Introduction to System Resources|6-1.2|10,54
     The peripheral devices permit you to obtain 
a printed copy of your text or store data on 
removable media such as disks or tapes, thus 
providing you with a means for moving data from 
one computer system to another.
 

     Each of your peripheral devices is treated 
like a file by the system and, therefore, has a
device file name.

P3

Using System Resources|Introduction to System Resources|6-1.3|15,54
     This lesson will show you commands for using 
your system's off-line printer, commands for reading 
and writing to disks, and commands for using other 
devices.


     Because the peripheral manipulation commands 
use some advanced concepts, you are asked to accept 
the commands at this point without much discussion 
of how they work.


     The latter chapters and other tutorials will 
provide you with the background necessary to fully 
understand them.

TOPIC2

How to Print Files

P4

Using System Resources|How to Print Files|6-2.1|13,54
     The standard UNIX command for sending files 
to an off-line printer is lpr.  To print a file 
named report the command would be:

lpr report


     The lpr command has several options including 
an option to request multiple copies of the same 
file.  For example, to print five (5) copies of the
file report you would type:

lpr  -n5  report
Using System Resources|How to Print Files|6-2.1|13,54
     The standard UNIX command for sending files 
to an off-line printer is lp.  To print a file 
named report the command would be:

lp report


     The lp command has several options including 
an option to request multiple copies of the same 
file.  For example, to print five (5) copies of the
file report you would type:

lp  -n5  report

TOPIC3

Using Magnetic Disks

P5

Using System Resources|Using Magnetic Disks|6-3.1|10,54
     If your UNIX system can handle tens or hundreds 
of users simultaneously, then the chance for you to
have access to a floppy disk drive on that system is
very slim.


     If, on the other hand, you are using a UNIX 
workstation or a supermicro based system, then floppy
disks are probably the most common removable data 
storage medium.

P6

Using System Resources|Using Magnetic Disks|6-3.2|8,54
     Before using a floppy disk you must know the 
required capacity of the disks used on your system.


     Capacity is measured in bytes.  A byte is the
amount of space needed to store one character.  A
kilobyte (Kbyte) is 1024 bytes.  A megabyte (Mbyte) 
is over one million bytes (1,024,000).

P7

Using System Resources|Using Magnetic Disks|6-3.3|7,54
     The most common type of disk media is double
sided double density, which permits you to store 
between 360 and 800 Kbytes of data depending on the 
system you are using.


     The double sided high density drive supplied 
with your UNIX system uses high density media which 
permit you to store 1.2 Mbytes of data.

P8

Using System Resources|Using Magnetic Disks|6-3.4|9,54
??Bsd: need Bsd version
     All magnetic media must be formatted before it can
be used.


     The command to format a floppy disk varies between 
systems, however the direct command is always some 
version of format.  For example:

fmtflop  $Unixdev$
format  $Xenixdev$

P9

Using System Resources|Using Magnetic Disks|6-3.5|7,54
     Check with your system administrator before using
these commands to make sure you are not formatting the
the system hard disk by mistake!


     You must also be aware that formatting will 
destroy any data already on the disk.

P10

???BSD: rest of this lesson needs bsd changes
Using System Resources|Using Magnetic Disks|6-3.6|10,50
     It is important to save or backup your files
on some removable medium (usually floppy disks) 
on a regular basis.  If you don't and the system
crashes, you can lose all of your work.  Backing 
up is also called dumping or archiving files.


     Once a disk is formatted you can archive (or 
write) files onto it using either the tar or cpio 
command.

P11

Using System Resources|Using Magnetic Disks|6-3.7|4,40
     The tar (tape archiver) command and 
the cpio (copy files in and out) command 
are similar.  They copy files on or off 
of a tape.  

P12

Using System Resources|Using Magnetic Disks|6-3.8|16,57
     cpio reads the standard input to obtain a list 
of pathnames and copies those files onto the standard 
output together with the pathname and status information.


     The format of the cpio command is:

ls pathname(s) -print | cpio -ocBv > specialfile

    pathname  is the pathname of every file to be 
              copied; 
 specialfile  is the name of the file corresponding to
              a disk drive; 
          B   means to Block 5120 bytes per record; 
          c   means to create ASCII header information;
          v   indicates to verbosely list the filenames.
Using System Resources|Using Magnetic Disks|6-3.8|14,50
     The tar command is one of the most reliable 
commands for data storage, portability and recovery.
It was originally designed to operate on magnetic 
tapes; however it also permits one to copy files to
or from other magnetic disks.


     The  format of the tar command for archiving is:

tar  cvf  specialfile  files

where f expects specialfile to be the name of the file
corresponding to a disk drive, c creates a new archive, 
and v is for verbose.

P13

Using System Resources|Using Magnetic Disks|6-3.9|9,54
     Before archiving on a floppy disk, make sure 
that the disk is firmly in place in the floppy disk 
drive and that the latch on the door is closed.


     The command to archive the file report onto the



ls  report  |  cpio  -ocBv  >  $Unixdev$
tar  cvbf  20  $Xenixdev$   report

P14

Using System Resources|Using Magnetic Disks|6-3.10|9,54
     You may obtain the table of contents of the 
files on your disk either by using a selection from 
your system's menu or by using a direct command.


     The command that allows you to check the
table of contents on an archive made with cpio is:

cpio  -icBtv  < $Unixdev$
     The command to see which files are stored on 
the disk is:
tar  tvbf  20  $Xenixdev$

P15

Using System Resources|Using Magnetic Disks|6-3.11|13,54
     You can restore files saved on a disk, that 
is, copy files from the floppy disk back onto the 
hard disk.


     Before copying files from the floppy disk onto 
the hard disk, make sure that the files being copied 
from the floppy disk will not overwrite any files 
with identical names on the hard disk!


     You may restore one or several files from a 
floppy disk.

P16

Using System Resources|Using Magnetic Disks|6-3.12|11,54
     The command to restore the files lesson and 
accept.c into the current directory from the floppy 
disk is:

tar  xvbf  20  $Xenixdev$  lesson  accept.c 


     The command to restore all of the files on the 
disk is:

tar  xvbf  20  $Xenixdev$
Using System Resources|Using Magnetic Disks|6-3.12|13,54
     The command to restore all of the files on the 
disk is:

cpio  -i  [Bcdmrtuv] < device name

For example:      cpio  -icBdv  <  $Unixdev$


     The command to restore the files lesson and 
accept.c into the current directory from the floppy 
disk is:

cpio  -icdBv  <  $Unixdev$  lesson  accept.c

TOPIC4

Using Magnetic Tape

P17

Using System Resources|Using Magnetic Tape|6-4.1|14,54
     The commands for reading and writing to magnetic 
tape are similar to those for floppy disks.  The 
difference is the name of the device file associated 
with the magnetic tape drive.  


     If your system has the tar utility and a magnetic 
tape drive, then your magnetic tape drive is the default 
archiving device for tar.  For example, to archive all 
the files in the current directory and in all the 
directories below it onto the default archiving device,
mount a blank tape and type:

tar  c
??? this needs a few screens on restoring from tape from 7sa

P18

Using System Resources|Using Magnetic Tape|6-4.2|6,54
     In Topic 3, Using Magnetic Disks, you saw a few 
examples using the cpio command to copy files on and 
off of magnetic disks.  This command can also be used 
to copy files to and from magnetic tapes; only the name 
of the device will change from that of the disk drive 
to that of the tape drive.

P19

Using System Resources|Using Magnetic Tape|6-4.3|6,54
     If you are using a Hewlett-Packard computer, you 
can optimize the data transfer rate between some data 
cartridge units and your computer, and reduce wear 
and tear on your data cartridges and drives by using 
the tcio command in conjunction with the cpio 
command.

P20

Using System Resources|Using Magnetic Tape|6-4.3|16,54
     The syntax of the tcio command is:

tcio  [-ir]  -l #  -n #  tape drive name  |  cpio  ...

where 
    -i  stands for copy in
    -r  unloads the tape from the tape drive
  -l #  for multi-cartridge drives, starts by loading 
        cartridge number #
  -n #  for multi-cartridge drives, specifies the maximum 
        number (#) of cartridges to be used in a multi-tape 
        transfer

The command will read the Command Set 80 Cartridge Tape Unit 
and write the data to the standard output which then sends 
it to cpio.

TOPIC5

The UNIX Mail System

P18

Using System Resources|The UNIX Mail System|6-5.1|12,54
     Your UNIX system provides you with the
capability of sending electronic mail to other users 
on your system.


     You may be able to send electronic mail to the
users on another UNIX system as well; see your system 
administrator for details. 


     Here, we'll show you how to send mail to the 
local users.

P19

Using System Resources|The UNIX Mail System|6-5.2|14,54
    The command to send mail is mail.


     To send a mail message to the user joan
the command would be:

mail  joan <CR>

The system will prompt you with:      Subject:

To which you should type in a subject followed by <CR>
On the next line you can type your message.  Terminate 
your message with <CONTROL-d> and you should get your
shell prompt back.

P20

Using System Resources|The UNIX Mail System|6-5.3|15,54
     If you have a mail message, after you log in you 
will be prompted with:

You have mail


     To read your mail you type:

mail <CR>

You will get a note specifying the sender, the date and 
the subject.

By typing <CR> you can read mail messages in the order 
they were received.

MAIL

??? no review questions for 6uu