What is Linux?
==============

Linux is an operating system written by the Finnish programmer Linus
B Torvalds.  It is designed to look like the Unix operating system, and
the source of the entire system is available.  Binaries and source can
be distributed freely under the terms of the GNU Public License.  See
README.  Programs from the various System V and BSD versions of Unix
should compile and run under Linux with few changes.  Linux aims to
conform as closely as it can to the various POSIX, ISO, and ANSI standards.

Linux runs only on machines which have processors compatible with the
Intel 386 or 486.  If you intend to run Linux, your computer must have
appropriate hardware and sufficient resources:

   - You must have at least 2 Mb of memory to run Linux.  For good
     performance, you need at least 4 Mb of memory, and the X window
     system does not work well without at least 8 Mb.

   - Linux requires an ISA or EISA bus.  At present it does not support
     the MCA bus architecture.  This means that is does not run on a PS2
     machine.

   - Linux supports generic AT drives, including IDE and 16 bit hard
     disk controllers with MFM or RLL.  It supports generic XT
     controllers (8 bit hard disk controllers with MFM or RLL).  It
     supports SCSI disks and CD ROMs, provided the SCSI adaptor is
     supported.  Supported adaptors include Adaptec 1542 (but not 1522),
     Adaptec 1740 in extended mode (not in 1542 compatible mode),
     Seagate ST-01 and ST-02, Future Domain TMC88x series, any board
     based on the TMC950 chip, TMC1660 and 1680, Ultrastor 14F, 24F,
     and 34F, and WD7000.

   - You will need disk space for swapping (or paging) and for file
     systems.  A small installation can share a 40 Mb disk with DOS,
     but a full installation including the X window system may require
     a full 40 Mb for Linux files alone.  See README.prepare.

   - Linux supports several Ethernet cards, but the `official' kernel
     currently contains code only for Western Digital 8003 and 8013
     cards.  Patches for other cards are available, and will eventually
     be included in the `official' kernel.  There is not at present a
     patch to support the RM Ethernet cards, which are the most common
     cards in Manchester, but we hope to modify the drivers to support
     these cards in the near future.

   - Text mode supports VGA, EGA, CGA, and Hercules cards.  Linux
     supports graphics and X11 with EGA, normal VGA, some SVGA cards
     (ET3000, ET4000, Paradise, and some Trident chips), some S3 cards
     (but not Diamond Stealth), 8514/A, and Hercules.

Detailed information about currently supported hardware is published
in the Linux hardware list, which is available by anonymous ftp.  See
README.ftp.

Among the features of Linux are the following:

   - It is a multi-tasking system: several programs can run at the same
     time.

   - It is a multi-user system: several users can use the same machine
     at the same time.

   - Linux runs in 386 protected mode.  Different processes are
     isolated from each other, so that one program cannot bring the
     system down.

   - Executable files are demand-loaded, so that parts of a program are
     in memory only when those parts are being executed.

   - Compiled programs are linked with dynamically loaded shared
     libraries to reduce disk and memory usage.

   - Executables share memory pages until one of them writes to it.
     This increases speed and decreases memory use.

   - Programs access virtual memory which is paged to disk.  If you
     allocate up to 16 swap areas, each up to 16 Mb in size, all of this
     memory is available to running processes in a shared pool.

   - Physical memory is organised into a unified memory pool or cache,
     which changes in size depending on the system load.

   - The kernel can emulate a maths coprocessor if you have none.  If
     you have a coprocessor, you can recompile the kernel without the
     emulation code to save memory.

   - The kernel supports multiple virtual consoles, which allow several
     independent login sessions on the system console.

   - The kernel supports several file systems, including its own
     extended and extended version 2 file systems, MINIX, XENIX, and
     DOS compatible file systems, and a special "proc" file system for
     getting information about running processes.  Linux cannot access
     DOS 6 compressed partitions.

   - Linux supports TCP/IP networking, including ftp, telnet, NFS, and
     other protocols.

The software which is distributed in the MCC interim versions of
Linux comes from a variety of sources.  Much of it comes from the GNU
project, some of it is taken from the published BSD sources, and some
has been written specifically for Linux.

*WARNING:*
     Linux is an operating system which is very different from DOS.  It
     requires a certain minimal amount of attention if it is to work
     well.  In particular, you must *never* simply turn off a machine on
     which Linux is running.  For more information about using Linux
     safely, see the next section.


Using Linux
***********


Caring for your Linux system
============================

Linux is an operating system which must be handled more carefully
than DOS, or at least older versions of DOS.  There are some important
facts about Linux which will help you to have fewer problems and get
more out of your system.

Linux has several file systems, but all of the `native' Linux file
systems have one feature in common: they require special care which a
DOS file system does not.  First, information is not written to disk as
soon as it becomes available, but it is flushed at regular intervals
(every 30 seconds by default).  This improves performance.  But you must
*never* switch off a PC which is running Linux, since some data may not
get written to disk, and will be lost, and the data describing the file
system may become inconsistent, putting the files in the system at risk
of corruption.

To shut Linux down safely, there are several methods you might use:

  1. Give the command `sync' before switching off.  This forces the
     system to flush unwritten buffers.  To be a little safer, give the
     command twice, and wait for it to finish.

  2. Reboot the system either by pressing `CTRL-ALT-DEL', or by giving
     one of the commands `reboot' or `shutdown -r'.  This is better than
     the `sync' method.

  3. Stop the system by giving one of the commands `halt' or `shutdown
     -h'.  This is the safest method, but it can only be done by the
     user `root'.

For the same reason, floppy disks may be corrupted if you remove
them from the drive before unmounting them.  Should this happen, you can
repair them with the command `fsck'.  MCC interim distributions are
configured to run `fsck' on all mounted file systems at boot time,
unless you are rebooting after having given the command `shutdown' with
the `-f' option.

There are a few files, system logs and such, which grow without
limit.  The logs in `/usr/adm', particularly the file `messages', are
restarted whenever the system is booted, so they should not cause
problems unless you leave the system running for long periods, or when
the file system is nearly full.  But the file `/etc/wtmp' will grow
constantly, and you may need to shorten it.  To do this, log in as root
and give the command

     > /etc/wtmp

If you install networking software and connect your machine to the
outside world, you may be exposing yourself to unscrupulous hackers.  Be
careful to set passwords, particularly for the root user, using the
command `passwd'.

The superuser `root' has very great powers, and can easily damage or
delete the entire system.  It is a good idea to do most of your work as
`user' (or as some other user name), and to become root only when you
need to run one of the commands which only root can give.  For example,
you can make a file read-only by using the `chmod' command, so that a
simple `rm' command will not delete it, but `rm' will not normally ask
the root user for confirmation before deleting such a file.

To learn more about Unix systems, get a good book, read it, and
follow some of the advice it gives.


The msdos file system
=====================

The msdos file system provides the most convenient way of accessing
DOS floppies and hard disk partitions from Linux.  It allows you to
mount a DOS disk or partition as part of the Linux directory tree,
using the command

     mount -t msdos *options device directory*

Here is a particular example of a `mount' command:

     mount -t msdos -o ro,uid=100,umask=027,conv=text /dev/hda1 /mnt

There are some special options to the `mount' command which apply to
the msdos file system, and which are not included in the man page for
`mount'.  Among these are the following:

`uid=nnn'
     When an msdos file system is mounted, its files and directories
     have no `owner' as Linux understands it, so they are given, by
     default, the owner `root'.  If you wish to access these systems
     from another user name, it is convenient to pretend that another
     user owns everything in the mounted system.  To do this, use
     `uid=nnn', where `nnn' is the user's ID number from `/etc/passwd'.

`umask=nnn'
     When an msdos file system is mounted, its files have only the
     `write' permission (if they are not read-only files), and its
     directories have no permissions at all.  Permissions are set on
     the files and directories using the mounter's `umask'.  To change
     this, you may set the permissions by specifying an explicit
     `umask' on the `mount' command line.

`conv=*conversion*'
     DOS text files and Unix text files have different conventions for
     terminating lines.  By default, msdos file systems are mounted in
     such a way that no conversion is done.  This may be inconvenient
     if you are editing files on a DOS partition.  The option `conv=t'
     or `conv=text' converts all line terminators when files are read
     from or written to the mounted DOS file system.  This may lead to
     corruption of binary files.  A safer (but still risky) option is
     `conv=a' or `conv=auto', which tries to guess whether a file is a
     text file or a binary from its extension.


Special commands for DOS floppies and partitions
================================================

Mtools is a public domain collection of programs to allow Unix
systems to read, write, and manipulate files on a DOS file system.  The
DOS file system itself is usually a more convenient way to access DOS
file systems, but mtools provides the ability to format and label DOS
partitions, and they can allow non-root users to access floppy disks if
you change the permissions on the `/dev/fd*' files.

The following DOS commands are emulated:

     mattrib   ATTRIB       change DOS file attribute flags
     mcd       CD           change DOS directory
     mcopy     COPY         copy DOS files to/from Unix
     mdel      DEL/ERASE    delete a DOS file
     mdir      DIR          display a DOS directory
     mformat   FORMAT       add DOS file system to a low-level format
     mlabel    LABEL        make a DOS volume label
     mmd       MD/MKDIR     make a DOS subdirectory
     mrd       RD/RMDIR     remove a DOS subdirectory
     mread     COPY         low level read (copy) a DOS file to Unix
     mren      REN/RENAME   rename an existing DOS file
     mtype     TYPE         display contents of a DOS file
     mwrite    COPY         low level write (copy) a Unix file to DOS

These commands should not be used on mounted DOS file systems, since
the kernel may not recognise that changes have been made without using
the usual file system interface.

The pattern matching routine more closely resembles Unix than DOS.
For example, `*' matches all DOS files; it is not necessary to use
`*.*'.

The use of wildcards (or the '\' separator) requires the names to be
enclosed in quotes, so that the shell does not expand them.  For
example,

     mcopy "a:*.c" .

copies all files on the A: disk with the extension `.C' to the
current Unix directory.  On the other hand,

     mcopy *.c a:

copies all files with the extension `.c' in the current Unix
directory to the A: drive.  This time you *want* the shell the expand
the `*.c'.

The original programs have been modified so that the device
configuration is read at run-time from a file `/etc/mtools'.  Moreover a
check is performed to detect incorrect FAT type settings.

The configuration file `/etc/mtools' defines the mapping of DOS
drives to Unix devices.  An entry in /etc/mtools can have any of the
following formats:

     drive device
     drive device fat
     drive device fat cylinders heads sectors
     drive device fat cylinders heads sectors offset

Drive is the DOS drive letter, device is the name of the device on
Unix, fat is the number of bits a FAT entry has (either 12 or 16),
cylinders, heads, and sectors describe the disk geometry.  On hard
disks, the geometry parameters should all be zero.  Offset specifies how
many bytes should be skipped when accessing the device.  This is
necessary when using non-standard disk configurations.

The abbreviated entries are valid only on systems for which mtools
can `guess' the disk parameters by looking at the Unix device name.  If
this is not possible, an error message is issued.

Here is a sample configuration file:

     # /etc/mtools - mtools device definitions
     
     A /dev/fd0 12 80 2 15	# A: 5.25" HD
     A /dev/fd0 12 40 2 9	# A: 5.25"
     B /dev/fd1 12 80 2 18	# B: 3.5" HD
     B /dev/fd1 12 80 2 9	# B: 3.5"
     C /dev/hda1 16 0 0 0	# C: 30 MB HD partition

A portable entry for floppies can be created by using `0 0 0' for
the disk geometry:

     # /etc/mtools - portable mtools device definitions
     
     A /dev/fd0 12 0 0 0	# any A:
     B /dev/fd1 12 0 0 0	# any B:

This has the slight disadvantage that `mformat' refuses to work.

It is important to set the FAT type right because this parameter
can't be computed reliably from other parameters.  Mtools tries to detect
possibly incorrect settings and issues an error message.  If this check
should be bypassed, the FAT type has to be specified as a negative
number; for example:

     D /dev/hda2 -16 0 0 0

Determining the correct FAT type is critical for hard disks.  Writing
to a hard disk with an incorrectly set FAT type will destroy vital
information.  If you're not sure whether you have a 12 or a 16 bit FAT,
you should try reading a text file which is bigger than 8 Kb with the
`mtype' command.  You can use the commands `mcd' and `mdir' to locate
such a file.  The FAT type is wrong if `mtype' outputs data from other
files after a while.  The first few kilobytes are always read correctly,
whether the FAT type is good or not.


Commands peculiar to Linux
==========================

There are several commands peculiar to Linux, or with features
peculiar to Linux, of which you ought to be aware.  Most of these
commands have man pages which give useful information.  After the system
is installed, I suggest giving particular attention to the following
commands:

     clock(8)      fsck.minix(8)  mkfs.ext2(8)     setfdprm(8)
     doshell(8)    fstab(5)       mkfs.minix(8)    setserial(8)
     fdformat(8)   halt(8)        mklost+found(8)  shutdown(8)
     frag(8)       init(8)        mkswap(8)        swapon(8)
     fsck(8)       kbdrate(8)     mount(8)         update(8)
     fsck.ext2(8)  mkfs(8)        rdev(8)

The command for reading about each of these corresponds to

     man 5 fstab

where the `5' is replaced by the appropriate section number (usually
`8' for these commands), and `fstab' is replaced with the name of the
command.  The exception is the command `mklost+found', whose man page
can be read with the command

     man 8 mklost+fou

in order to comply with the constraints imposed on the current
distribution.
