Notes for Week 1

Linux is UNIX for the PC (and, it turns out, many other types of hardware as well). UNIX can be thought of as a collection of very sharp and precise tools, all of which can operate together using shell commands, to accomplish anything the user (or system administrator) desires, quickly and effectively. As an open-source project, Linux aims for and achieves complete transparency: nothing is hidden by the system, at least for the user who wants to find out. The Linux philosophy is almost diametrically opposed to the Windows philosophy, which is to control the user's experience, hiding all of the the "unnecessary" details, and forcing the user to work according to the paradigms Microsoft deems appropriate.

One of the most important attitudes the system administrator must adopt is this: you have to know how the system does what it does in order to use it effectively. For this reason, Linux is a system administrator's, as well as an educator's, dream, and to a large extent, Windows is their worst nightmare. There is a lot to learn in this course, so our approach will to be to use Linux as our primary platform, and indicate parallels and differences with Windows as we progress. When we must use Windows, as we must during our cross-platform file and print service labs, we will not shy away from doing so. But we will learn much more about system administration by working with an operating system that invites the administrator to learn everything they need to learn. That OS would be Linux.


The DVD-ROM you have been given is a self-contained, bootable Linux distribution built by Professor Koehler and based on the Linux From Scratch project. The goal for week 1 is to learn how to use it as a stand-alone operating system, without installing it on your hard drive.

Over the entire course, you will often be entering commands and data which can seriously damage your system if you type the wrong thing. So before we get started, let's establish one ground rule:
Never push the Enter key before reading what you typed and making sure it is correct!
You will have a longer and happier life if you can adhere to this rule.
You will find repeatedly that it is vitally important for you to know the details of your PC hardware. This distribution has been built for 32-bit Intel-compatible processors of Pentium Pro class or higher. It will not work on older processors (for instance, Pentiums or AMD K6s). It has been tested with the PCs in Muntz 265 (henceforward called "the lab PCs"); as is so often the case, your mileage may vary... There is no warranty of any kind, but bug reports will be cheerfully considered and possibly fixed. Expect problems to occur; it will make this course more like real life.

  1. In order to boot from the DVD-ROM, two things are necessary: it must contain an El Torito Standard image of a bootable floppy, and you must make sure that your BIOS knows to boot from the DVD-ROM drive before booting from the hard drive. The former has been built into the ISO image on the DVD-ROM. For the latter, on the lab PCs, you access the BIOS Configuration Program by pressing the F12 key during boot. You must then ensure the boot sequence is correct.
    On some systems, you must change the order back to what it was to allow booting from the hard drive once more. Other systems are more intelligent...
  2. It is a good idea to not use the numeric keypad during startup. The key codes are different and the keymap may not be installed yet. Use the row of number keys above the letters when entering numbers.

    Also, the vast majority of commands and data values in Linux are lower case; Linux is case-sensitive, so take care to only use upper case when it is necessary.

  3. When booting from the DVD-ROM, you will receive a "boot:" prompt. Enter
    linux
    and push the Enter key to boot Linux.
    "linux" is the label of the compressed kernel image (the file which contains the kernel) on the El Torito floppy image. Our kernel version is 3.13.3, denoting major release 3, minor release 13 and revision 3.
  4. As the startup process unfolds, a large number of status messages are displayed, far too quickly to read as they happen. To scroll up and down through the display, you can use Shift-Page Up and Shift-Page Down.
  5. The startup process will ask for a device name for /var (/var is where writeable data is stored). Until we install it to a hard drive partition or a flash drive, enter
    RAM
    DVD-ROM drives typically have access times 20-30 times slower than hard drives. Running off a DVD-ROM is therefore usually a slow process, and you will definitely notice this. In addition, the DVD-ROM is obviously read-only, so you can't modify any of its files. By answering "RAM", the startup process will create a 64 MB ram disk for /var, to provide you with a place to modify files.

    This requires 64 MB of free RAM over and above the kernel and any software you care to run. For this reason, this distribution will only run well on PCs with at least 256 MB of RAM.

  6. The rest of the questions are for networking configuration. In 265, the questions and answers are as follows ("pnn" refers to the patch panel and port number your PC is connected to, and can be found on a label on the PC):
    QuestionAnswer
    hostnamecpnn.lab265
    IP address192.168.1.pnn
    IP of gateway192.168.1.1
    Number of bits in network portion of IP address24
    Broadcast Address192.168.1.255
    IP of DNS server10.228.64.129
    If any of these are entered incorrectly, networking will not function properly. Do not answer "yes" to the final question until you are sure you have everything correct.

    In Windows, these parameters are specified using the "Network Connections" control panel. Choose the interface to configure, then choose Properties, then choose TCP/IP and finally choose Properties again.

    If your PC is permanently connected to an Internet Service Provider, you may enter DHCP (Dynamic Host Configuration Protocol) for the IP address and the next four answers will be discovered automatically during network startup.

  7. The command prompt has the form "user [ currentworkingdirectory ]$", for instance

    ken [ ~ ]$
    or
    root [ /etc ]#
    where the tilde ("~") indicates the user's home directory (in the first case, /home/ken). Note that for root, "#" replaces "$", and the prompt is in red instead of green.
    As the name "command prompt" implies, the first thing you enter must be either a built-in shell command or the name of an executable program or script. After the command, and usually separated by spaces, come any parameters which might be necessary.
  8. The column of icons across the left hand edge of the screen is called the dock. The icons, from top to bottom, correspond to the following programs:

    1. wprefs: the WindowMaker preferences program
    2. xterm: opens a command line window; you can open multiple windows (and do multiple things simultaneously) by right-clicking on a dock icon and choosing "Launch"
    3. emacs: a text editor; most of the files we will work with are simple text files
    4. seamonkey: a web browser, chat, mail and news client
    5. audacity: a sound editing program
    6. geeqie: a photo browser
    7. gimp: a photo editor (like Photoshop and almost as powerful)
    8. libreoffice: an office suite (reasonably compatible with Microsoft Office)
    9. xcalc: a scientific calculator
    10. xpdf: a PDF viewer (like acrobat reader, but simpler and more reliable)

    Note that two programs are already running: xclock, in the lower left corner, and xosview (which monitors system activity) in the upper right.

  9. Open an xterm window by double-clicking on its dock icon. Enter pwd (print working directory) to see what your current directory is; this is root's home directory.
    You will sometimes need to terminate a command before it finishes. To do this, enter Ctrl-C.
    Xterm provides a window with a shell to process UNIX commands (sort of like the Windows command prompt, but equipped with warp drive and a time machine). Use multiple Xterm windows to do several things at once at command prompts. A couple xterm parameters of note are:

    The system is set up to use bash for the shell. Bash supports filename completion (type a partial file name and push the Tab key, and bash will attempt to find the correct file and fill in the rest of its name) and command history (accessed by using the up and down cursor arrows on the keyboard).

  10. Enter ls -l / (list, long format) to see the top-level directories in our Linux filesystem.
    The filesystem on our Linux distribution looks (in part) like this:
    / - this is the root of the filesystem (comparable to "C:")
    • bin - this is where essential system programs are kept (comparable to "C:\Windows\System32")
    • boot - this is where information necessary to boot Linux is kept (like NTLDR and BOOT.INI in "C:\")
    • dev - device files are stored here
    • etc - configuration files are stored here (somewhat comparable to the registry)
    • home - non-root users' home directories are kept here (sort of like "C:\Documents and Settings")
    • include - API header files are stored here
    • lib - system libraries are stored here (like .dll files in "C:\Windows\System32")
    • lost+found - if your filesystem is damaged, pieces of damaged files are placed here
    • media - contains several mount points (more in week 2)
    • mnt - a mount point (somewhat like drive letters)
    • opt - some "optional" software is stored here
    • proc - a "pseudo-filesystem", which provides a window on the running operating system (more in week 4)
    • root - root's home directory
    • run - another pseudo-filesystem, containing system volatile data
    • sbin - contains system programs normally only run by root (like some .exe files in "C:\Windows\System32")
    • srv - server data is kept here
    • sys - another pseudo-filesystem
    • tmp - where temporary files are created; any user can write to this directory (comparable to "C:\Windows\Temp")
    • usr - where the vast majority of the system software and documentation lives (sort of like "C:\Program Files")
    • var - information used during system operation is stored here

    Note that etc, home, root, srv and tmp are symbolic links (like short-cuts) to directories of the same names in /var. All subdirectories of the root directory (/) which contain files which are usually modifiable have been consolidated in /var, which is on the RAM disk. The remaining directories in the root filesystem are accessed from the DVD-ROM.

    Note too that there are copies of all of the top-level directories in /var (for instance, etc) on the root filesystem, but once /var is mounted, they are not accessible. However, the contents of certain files and directories (fstab, inittab and rc.d) must be the same on both filesystems. This is because they are accessed before and after /var is mounted during the startup process.
  11. Start seamonkey (the open source version of Firefox) by double-clicking its dock icon. Type "Alt-m" to maximize the window. Open the professor's web site by choosing "Ken Koehler's Web Resources" from the Bookmarks menu.
    To search for text within a web page, just click in the window and type the text you wish to find. You can find additional occurrences using "Ctrl-g". You will first have to set "Find As You Type" (in Edit/Preferences/Advanced/Find As You Type) to "Any text in the page".
    To see how the DVD-ROM was built, choose "Open File" from the File menu and choose "/root/rwclfs.html".
    Note that as you move your mouse over first the seamonkey window and then the xterm window that the color of the title bar changes; this is called input focus; the window in focus (dark title bar) is the one which receives keystrokes from the keyboard.
  12. You can copy and paste any text between windows by highlighting the text you wish to copy (which automatically copies that text into a paste buffer) and then, after positioning the cursor where you wish to paste the text, pushing the scroll wheel button (or both mouse buttons simultaneously). If you're pasting into emacs, you can also press "Ctrl-Y".

    For many of the dock programs, you can also paste into the icon. If you have copied a file name, the program will open that file.

  13. To paginate output, or just to peruse a text file, use less (sort of like MORE in Windows). For example, enter less README at the command prompt. Less supports the following key bindings:

    If you enter "/(pattern)" and push the Enter key, less will search forward until it finds the next occurrence of "pattern". Each time you push the "n" key, it goes to the next occurrence of "pattern"; each time you push the "N" key, it goes to the previous occurrence of "pattern".

  14. The following commands access the built-in documentation:

    Your path is displayed by echo $PATH; it is a list of all of the directories in which bash will search for commands to execute when you enter one at the command prompt. PATH is an environment variable; an environment variable must be preceded by a dollar sign to refer to its current value.
    xman can be started from an xterm window and used to examine which manual pages are available by section, and read those of interest. Sections of interest are:

    Nearly all commands have some default behavior (which takes place if options or parameters are left off). Be aware of the default behavior of the commands you use; as an example, if the user parameter is left off of the passwd command, the password of the user running the command is changed!
    Many of the man pages are "incomplete"; in these cases, the real documentation is in the "info" page. For instance, man grub produces a short summary of the grub command, while info grub is a small book on the subject. info navigation uses the following keys:

    In addition to these resources, there is a vast amount of documentation in the directory /usr/share. Most of it is either plain text files or HTML; it is organized by package, and is often found in a subdirectory called "doc".

  15. To quit an xterm window, enter the exit command.
  16. To quit X-Windows, right click on the desktop and choose "Exit".

    To shut down the system, enter either shutdown -h now or reboot or Ctrl-Alt-Delete at the command prompt (after exiting X-windows).

    NEVER TURN THE PC OFF WITHOUT FIRST SHUTTING DOWN OR REBOOTING!

    The single most common cause of PC problems is improperly-terminated software.


©2015, Kenneth R. Koehler. All Rights Reserved. This document may be freely reproduced provided that this copyright notice is included.

Please send comments or suggestions to the author.