LPI Linux Certification in a Nutshell (35 page)

Read LPI Linux Certification in a Nutshell Online

Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger

Tags: #Reference:Computers

BOOK: LPI Linux Certification in a Nutshell
7.96Mb size Format: txt, pdf, ePub
Chapter 8. Exam 101 Review
Questions and Exercises

This section presents review questions to highlight important
concepts and hands-on exercises that you can use to gain experience with the
topics covered on the LPI 101 Exam. The exercises can be particularly useful
if you’re not accustomed to routine Linux administration and should help you
better prepare for the exam. To complete the exercises, you’ll need a
working Linux system that is not in production use. You might also find it
useful to have a pen and paper handy to write down your responses as you
work your way through the review questions and exercises.

System Architecture (Topic 101)
Review Questions
  1. Describe the boot process on a PC, and identify the
    order in which control passes as a system boots.

  2. Name three files in the
    /proc
    filesystem
    that contain information on system resource allocations.

  3. Which of the following SCSI interfaces has the fastest data
    transfer rates: SCSI-1, SCSI-2, Ultra SCSI, or Fast-Wide
    SCSI?

  4. What is the naming convention in
    /dev
    for
    the different hard disk interfaces?

  5. What command is used to obtain USB information on a Linux
    system?

  6. What driver is used for USB hard drives?

  7. What is your default runlevel? How can you tell?

Exercises
  1. Boot your PC and enter the BIOS configuration utility.
    Determine how to change the boot order and how to enable and disable
    peripherals built into the motherboard.

  2. Examine the enabled serial and parallel ports. Can you
    manually configure the interrupts and I/O ports assigned to
    them?

  3. Examine your modem and sound external interfaces on your PC.
    Are the devices built into your motherboard or independent expansion
    cards?

  4. If you have a SCSI controller, reboot your PC and enter the
    SCSI BIOS. What device number is selected, if any, for boot? How are
    the controller’s onboard terminators configured? What data rate is
    the controller configured for?

  5. If you have a RAID controller, reboot your PC and enter the
    RAID BIOS. What options do you have to configure RAID on your
    system?

  6. Examine the kernel’s interrupt assignments by executing
    cat /proc/interrupts
    . Are your devices reported
    correctly? Are any devices sharing interrupts?

  7. Review output from
    cat /proc/dma
    and
    cat /proc/ioports
    .

  8. Create a list of all installed PCI devices using
    lspci
    . Note the devices built into your
    motherboard.

  9. Run
    lsmod
    and match the loaded kernel
    modules with hardware in your system.

  10. Connect a USB device (mouse, printer, etc.) to your system.
    Run
    lsmod
    to verify that the appropriate driver
    loaded.

  11. Run the
    dmesg
    command and go through the
    hardware your kernel recognized at boot time.

  12. Reboot the system and modify the grub boot line to boot into
    single-user mode.

  13. At the root prompt, type
    kill 1
    . What
    happens? Why?

Linux Installation and Package Management (Topic 102)
Review Questions
  1. Why is the
    /var
    directory usually
    located in a partition of its own?

  2. As a system administrator for a network with many workstations
    and a central NFS file server, how can you safely share
    /usr
    with your users while still maintaining
    control of its contents?

  3. What is the recommended size for a swap partition, as a
    function of the memory in a system?

  4. Describe how to create a
    tar
    archive and
    how its contents are extracted.

  5. In general terms, describe the procedure used to compile and
    install free or open source software from source code.

  6. What is a shared library? How can you determine what library
    dependencies exist in a compiled executable?

  7. How does your system know where to look for shared
    libraries?

  8. Briefly describe the major functional modes of
    rpm
    .

  9. How do you add additional repositories to
    yum
    ?

  10. What are the reasons to choose LILO over GRUB as a boot
    loader, or vice versa?

  11. Why might a Debian Linux administrator use
    dpkg
    -iG
    instead of simply
    dpkg -i
    to
    install a package?

Exercises
  1. In a shell, examine your disk layout using
    fdisk
    . For example:

    #
    fdisk /dev/sda
    Command (m for help):
    p
    Disk /dev/sda: 200.0 GB, 200049647616 bytes
    255 heads, 63 sectors/track, 24321 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x0003bf13
    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 25 200781 83 Linux
    /dev/sda2 26 89 514080 82 Linux swap / Solaris
    /dev/sda3 90 24321 194643540 83 Linux

    Is the entire disk consumed by the existing
    filesystems?

  2. Examine how system directories are mapped to disk partitions
    on your system. Are
    /var
    and
    /tmp
    in their own partitions? Is
    /boot
    in its own partition within cylinder
    1024? Is the root filesystem relatively small?

  3. Download a
    tarball (from
    http://sourceforge.net
    , for
    example), and install it on your system with the following
    steps:

    1. Unpack it using
      tar -xzvf file
      (or
      tar –xjvf file
      if it is compressed with
      bzip2).

    2. Configure it with
      ./configure
      .

    3. Build the software using
      make
      as
      directed in the documentation.

    4. Install the software using the instructions
      provided.

    Were there any difficulties with this procedure?

  4. Use
    ldd
    to examine library dependencies
    of executable programs on your system. For example:

    #
    ldd `which gcc`
    linux-gate.so.1 => (0x00110000)
    libc.so.6 => /lib/libc.so.6 (0x00682000)
    /lib/ld-linux.so.2 (0x00663000)
  5. Using a system that utilizes
    dpkg
    , obtain
    a list of all packages installed under
    dpkg
    management with
    dpkg -l | less
    . Find a package
    in the list that looks unfamiliar, and query information about the
    package using
    dpkg -s pkg_name
    .

  6. Using a system that utilizes RPM, obtain a list of all
    packages installed under RPM management with
    rpm -qa |
    less
    . Find a package in the list that looks unfamiliar,
    and query information about the package using
    rpm -qi
    pkg_name
    .

  7. Using a system that utilizes RPM, obtain a list of all
    available packages that you can install from the currently
    configured repositories with
    yum list available |
    less.

GNU and Unix Commands (Topic 103)
Review Questions
  1. Describe the difference between shell variables and
    environment variables.

  2. Compare and contrast built-in and explicitly defined commands
    and those found in
    $PATH
    .

  3. After a lengthy session of file manipulation on the command
    line, what will
    !ls
    produce?

  4. What files does
    bash
    read when you log
    in?

  5. Explain the notion of
    pipes
    as they refer
    to shell capabilities, and illustrate using an example of two or
    more filter programs.

  6. Explain the
    -p
    option to
    cp
    and give an example of why it is
    necessary.

  7. Give two examples of files matched by the wildcard
    ??[!1-5]
    .

  8. Name the three standard I/O streams and their
    functions.

  9. Give an example of the redirection operator,
    >
    , and describe how the outcome would
    be different using the
    >>
    operator.

  10. What process is the parent of all system processes? Give both
    the PID and the program name.

  11. Name three common utilities used for process
    monitoring.

  12. What happens to a typical daemon when it receives
    SIGHUP
    ? How would the behavior be
    different if it received
    SIGKILL
    ?

  13. Compare and contrast background and foreground jobs, and state
    the syntax to put a command in the background on the command
    line.

  14. What two classifications of characters make up regular
    expressions?

  15. How are the regular expressions
    [A-Z]*
    and
    ^[A-Z]*$
    different?

  16. What is the difference between executing
    :q
    versus
    :q!
    in
    vi
    ?

  17. What does it mean to put
    vi
    into
    command mode
    ?

Exercises
  1. Start a
    bash
    shell in a console or
    terminal window and enter the following
    commands
    :

    $
    MYVAR1="Happy"
    $
    MYVAR2="Birthday"
    $
    export MYVAR1
    $
    bash
    $
    echo $MYVAR1 $MYVAR2
    $
    exit
    $
    echo $MYVAR1 $MYVAR2
    1. Was the behavior of the two
      echo
      commands identical?

    2. If so, why? If not, why not?

    3. What happened immediately after the
      bash
      command?

    4. Which variable is an environment variable?

  2. Continuing the previous exercise, press the up arrow until you
    see the last
    echo
    command. Press the up arrow
    again.

    1. What do you see?

    2. Why wasn’t it the
      exit
      command?

    3. Press the up arrow again so that the
      export
      command is displayed. Add a
      space and
      MYVAR2
      so that the
      line now looks like this:

      $
      export MYVAR1 MYVAR2

      What happens when you enter this command?

  3. Still continuing the previous exercise, enter the command
    !echo
    . Does anything change as a result of the
    revised
    export
    command?

  4. The
    file
    command is used to examine a
    file’s contents and displays the file type. Explain the result of
    using
    file
    as follows:

    $
    cd / ; file `ls | head -10`
  5. Execute this command on your system:

    $
    cut -d: -f1 /etc/passwd | fmt -w 20 | head -1
    1. What was displayed?

    2. How many lines of output did you see? Why?

    3. What was the width of the output? Why?

  6. Execute the following
    sed
    substitution
    command and explain why it might be used on
    /etc/passwd
    :

    $
    sed 's/:[^:]*:/:---:/' /etc/passwd | less
  7. Execute this command:

    $
    cd /sbin ; ls -li e2fsck fsck.ext2
    1. What is the significance of the first field of the
      output?

    2. Why is it identical for both listings?

    3. Why are the file sizes identical?

  8. Execute the following command sequence and explain the result
    at each step (this example assumes that
    cp
    is
    not aliased to
    cp -i
    , which is a common default
    alias):

    $
    cd
    $
    cp /etc/skel .
    $
    cp -r /etc/skel .
    $
    cp -rfv /etc/skel .
    $
    cp -rfvp /etc/skel .
  9. Remove the directory created in the previous exercise, using
    rmdir
    and/or
    rm
    . Which
    command can complete the task in a single step?

  10. Explain when the wildcard
    {htm,html}
    might be useful.

  11. Give an example of how the wildcard
    *.[Tt][Xx][Tt]
    could be used with
    directory listings.

  12. What can be said about filenames matched by the
    *.?
    wildcard?

  13. Experiment with redirecting the output of
    ls
    as follows:

    $
    cp /etc/skel . 2> info.txt
    1. How is the terminal output different than that observed in
      Exercise 8?

    2. What is written to
      info.txt
      ?

  14. Experiment with
    ps, pstree
    , and
    top
    to monitor active processes on your system.
    Include
    top
    ’s interactive commands.

  15. If you have Apache running, use
    ps
    (and
    perhaps
    grep
    ) to identify the
    httpd
    process and its PID, which is owned by
    root. Send that process the
    HUP
    signal as follows:

    $
    kill -SIGHUP
    pid

    Using
    tail
    , examine the Apache error log
    (the location of your logfile may differ):

    $
    tail /var/log/httpd/error_log

    What was the effect of
    HUP
    on Apache?

  16. While running X, start some interactive processes in the
    background and experiment with using
    jobs
    ,
    bg
    , and
    fg
    . For
    example:

    $
    firefox &
    $
    xterm &
    $
    emacs &
    $
    jobs
    $
    fg 1
    $
    fg 2...

    Were you able to bring each of the jobs to the foreground
    successfully?

  17. This exercise starts a process, using various methods to view
    and modify the process execution priority:

    Start an editing session in the background using
    nice
    :

    $
    nice vi &

    Observe that the process was
    nice
    ’d using
    ps
    :

    $
    ps -u

    Check it again using
    top
    :

    $
    top -i

    Within
    top, renice
    the
    vi
    process using the
    r
    command and observe the effect on priority.

    Exit
    top
    and use
    renice
    to set the nice value back to
    zero.

  18. Use a simple regular expression with
    grep
    to find
    bash
    users in
    /etc/passwd
    .

  19. Examine the difference between grep and egrep by issuing the
    following
    commands
    :

    $
    grep ".+:x:.+:/bin/bash$" /etc/passwd
    $
    egrep ".+:x:.+:/bin/bash$" /etc/passwd

    How is the output of these commands different? Why?

  20. Determine the number of empty lines in
    /etc/inittab
    .

  21. Use
    vi
    to create a text file. Enter
    insert mode
    with
    i
    and insert text. Quit insert mode with
    Esc and move around using
    h
    ,
    j
    ,
    k
    , and
    l
    , then re-enter insert mode and add more
    text. End the session with
    ZZ.
    cat
    the file. Is it as expected?

Other books

Three Men in a Boat by Jerome K. Jerome
Simon Says Die by Lena Diaz
The Botox Diaries by Schnurnberger, Lynn, Janice Kaplan
Drive by Sidney Bristol
THE GIRL NEXT DOOR by CYNTHIA EDEN,
Ben the Dragonborn by Dianne E Astle