[RHCE] Notes from Prerequisites Session 1

Max T. Woodbury Max.TenEyck.Woodbury at verizon.net
Tue Sep 16 18:07:46 EDT 2003


First, I'm sorry for going into 'lecture mode'.  I understand that it
can be annoying but we were drifting and there is a lot of material to 
cover.

The topic was basic operations that are needed to use Linux.  This
material is covered in first section of the Osborn RHCE 3rd Ed. Since 
the purpose of our gathering is to get an RHCE, I'm going to skip a 
lot of 'other *NIX does it this way' stuff that was discussed and 
focus on what Red Hat Linux provides.

NOTE: I've added a little that got skipped. Marked with (+).

The 'vi' editor is small enough that it can fit on the 'rescue disk' 
and functional enough to be useful. 'emacs' is too big and 'sed' is not
as functional.

vi - roughly equivalent to MSDOS 'edit'
  This is a 'modal' editor. There are three basic modes. You start in
  'navigation' mode. You have to go to 'edit' mode to insert text.
  There is also a 'command' mode.
  In both navigation and edit mode, the arrow keys move you around.
  There are several ways to go from navigation to edit modes. The 
  simplest is 'i'. To go from edit back to navigation use the 'esc'
  key. Command mode is entered with the ':' key. Exit vi
  with the :wq command to save what you've done or :q! do discard what
  you've done.

  Cut, Copy and Paste from navigation mode: Cut - <n>dd where <n> is a
  decimal number deletes <n> lines and saves the last one in a buffer.
  d<n>d deletes <n> lines and saves all <n> in the buffer. Copy - 
  y<n>y copies <n> lines into the buffer without deleting starting 
  with the current line. Other commands also save stuff into the
  buffer. When something is put in the buffer, the previous contents
  are lost. Paste - p inserts the contents of the buffer after the
  cursor - into the next line if the buffer contains lines. P inserts
  before the cursor. (No, I'm not absolutely sure that <n>dd and d<n>d
  do different things. I suggest everybody try it and see.)

Directory structure - RH's directory structure is not entirely
'standard', but its what is needed for the RHCE. Mount points are 
places other file systems can be inserted into the basic directory 
tree. (+) Linux and *NIX in general do not use 'drive letters' to 
designate which file system is being used. It's all one huge tree.

/           The 'root' of the file system 'tree'.
/bin        For user command stuff needed at boot time. NOT a mount
            point.
/boot       Basic boot time stuff. Often a mount point.
/dev        10,000 device names and more. NOT a mount point.
  cdrom           The CD-ROM drive (+)
  fd<0,1>         Floppy drives (A: and B:)
  hd<a-t>[n]      IDE drives (up to 16) with partitions. 0 is the whole
                  disk.
  mouse           The mouse (+)
  sd<a...>[n]     SCSI drives and partitions. aa, ab... if there are
                  more than 26.
  tt...           'terminals' (+)
/etc        System configuration files - lots of em. NOT a mount point.
/home       Where the user's stuff is. A mount point on all but the
            smallest systems.
/initrd     A 'RAM' disk used during boot. Dismounted after the initial
            phases of the boot process to keep its contents safe from
            glitches.(+)
/lib        Libraries needed at boot time. NOT a mount point.
/lost+found Stuff that 'fsck' has recovered. There's one for each real
            file system.
/misc       Optional mount points for the 'automount'er.
/mnt        Contains a bunch of mount points. NOT a mount point under
            RH.
/opt        3rd party stuff.
/proc       Always a mount point - connects to a 'pseudo' file system
            that lets you see inside the kernel.
/root       'root's home directory. NOT a mount point.
/sbin       For admin command stuff needed at boot time. NOT a mount
            point.
/tmp        Temporary stuff. Gets pruned from time to time. NOT a mount
            point.
/usr        Catchall directory. Can be a mount point.
  bin       The rest of the user command stuff.
  lib       The rest of the libraries
  sbin      The rest of the admin command stuff.
  tmp       More temporary files. (+)
  ...       Lots of other stuff.
/var        System state stuff and other information. Can be a mount
            point.
  log       Log files. See /var/log/rpmpkg for a list of RPMs installed.
  tmp       Temporary files that are pruned on each boot. (+)
~           Your home directory. Specified in /etc/passwd.
~<name>     'name's home directory.

You can add other directories at the bottom level as you see fit.

fdisk       Similar to its MS-DOS equivalent but does a lot more. 'm'
            displays help.
mkfs        Makes a file system. I haven't played with this. Dangerous.
fsck        Check a file system. The file system must NOT be changeable
            unlike the MS-DOS chkdsk or scandisk equivalents.
mount       Connect a device to a mount point using a file system. Uses
            /etc/fstab to 'fill in the blanks'.
umount      Reverses the effect of 'mount'

pwd         Displays your 'working directory'. PWD is a shell symbol
            with the same information. $PWD can be used to substitute
            that value into a command.
cd          Change directory - like the MS-DOS command. Without an
            argument it send you to '~'.
ls          Like MS-DOS 'dir', but a huge number of options are
            available. Note the effect of the 'language' definition on
            the order of list. (+) The -d option displays directory
            attributes rather than contents when using wild cards.
find <start> <actions>  Does <actions> for everything in the <start>
                        tree. The default <action> is to print the name
                        of whatever. A useful <action> is -name which
                        does name matching. Take care to 'escape' any
                        leading wild card characters with '\'. (+)
locate      Searches a database for file names. The database is normally
            rebuilt every night. This can eat a lot of computer time at
            4 AM and will often trigger faults on marginal hardware.
cat         Equivalent to MS-DOS 'type'. Note that Linux 'type' does
            something else.
less, more  Similar to MS-DOS 'more'. 'less' is more useful and can
            shift you into 'vi' under some circumstances.
head, tail  Displays the first or last part of a file. 'tail -f' lets
            you 'follow' a file as it is being written.'
cp          Equivalent to MS-DOS 'copy'. Check out the '-a' switch.
mv          Equivalent to MS-DOS 'move'.
ln          Like 'cp' but creates a 'link' rather than actually making a
            copy of the file.  It provides an 'alias' for the file.
rm          Equivalent to MS-DOS 'del'. (+)
grep, egrep Look for something inside a file. Note that there is a
            'fgrep' for 'fast grep' but 'egrep' is usually faster than
            'fgrep'...
sort        You guessed it... It uses the local 'language' definition to
            determine the order, so it puts things in the order 'A',
            'a', 'B', 'b'... (+)
wc          Counts things, lines, words, characters.
ps          Displays 'processes'. Lots of options.
who, w      Displays 'users'.
lpr, lp     Send a file to the printer. Spooled. Defaults can be set for
            each user and globally. There are filters that try to do
            the 'right thing' with 'binary' files.
file        Examines a file to determine what kind of file it is. This
            is used by lpr to figure out what the 'right thing' to do
            to a file is.
lpq         Displays the spool queue.
lprm        Removes a 'job' from the spool queue.
pr -f       Adds headers, page numbers, ... to simple text files.
man         Displays help on a topic, particularly commands. It helps a
            lot to include the 'man pages' in any installation.
info, pinfo Another help system.

su -        Become the 'super user'. The '-' is short for '-l'. It means
            'do a login' to establish a complete environment. This adds
            the 'admin' commands to the normal user repitoir.

Wild cards - '*' matches any number of characters, including none. If
used alone, it becomes a list of files in the current working 
directory. '?' matches any one character. [...] matches any character 
in the list '...'. Ranges can be abbreviated. For example [A-Z] matches
any upper case letter. (+).

We stopped on page 21.

Things in the book that have been skipped:

Configuring printers. I expect that this will be covered under 'cups'

Tarballs. It says that a lot of packages are distributed as 'tarballs'.
While true, the exam is almost certainly only going to cover 
installation using RPMs. (Tarballs are needed to build RPMS. Is 
building RPMs covered by the exam?)

fdisk details.

Things that the book suggests that may be poor practice:

Editing the /etc/passwd file with vi. Use 'vipw' to create a lock file
that keeps other tools out of that file while you're fiddling. Better,
use the admin tools like 'add_user'.


More information about the RHCE mailing list