LPI Linux Certification in a Nutshell (36 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
5.73Mb size Format: txt, pdf, ePub
Devices, Linux Filesystems, and the Filesystem Hierarchy Standard
(Topic 104)
Review Questions
  1. What are the three types of disk partitions found on a
    Linux system? Which type can contain other partitions, and which
    type does it contain?

  2. Name the directories that must be within the
    /
    partition.

  3. Describe the differences between physical disks, partitions,
    and filesystems.

  4. What is a journaling filesystem and how does it differ from a
    nonjournaling filesystem?

  5. What is a
    swap
    partition used for? Why
    not just use swap files?

  6. What kind of output will
    df -h
    yield?

  7. Describe a common situation that is likely to cause the
    automatic use of
    fsck
    on the next system
    boot.

  8. Name the fields in
    /etc/fstab
    .

  9. Give the command to mount a CD-ROM drive on the secondary
    master IDE device, assuming that
    /etc/fstab
    does not contain a line for the device.

  10. If the
    ro
    option is used in
    /etc/fstab
    for
    /usr
    , what
    limitation is placed on that filesystem?

  11. Compare and contrast hard and soft quota limits.

  12. Name the symbolic permission that is equivalent to
    0754.

  13. Describe a situation that requires the SUID permission. What
    ramifications does this permission imply?

  14. How do you determine what binaries on your system have the
    SUID bit set?

  15. Compare and contrast the differences between hard and symbolic
    links.

  16. Name the document to which Linux directory assignments should
    conform.

  17. Compare and contrast the differences between the
    locate
    and
    find
    commands.

Exercises
  1. As root, run
    fdisk
    on your main hard
    drive and enter the
    p
    command to
    print the partition table. Examine your system’s configuration and
    make sure you understand everything you see. Enter the
    l
    command and review the many partition
    types Linux can accommodate. Enter the
    q
    command to quit without saving
    changes.

  2. If you have available disk space, use
    fdisk
    to create a new
    ext3
    partition, and then format it with
    mkfs
    . Pay
    close attention to the output from
    mkfs
    .

  3. Use a pager to examine
    /var/log/messages
    and search for entries made by
    fsck
    . Did it
    find any problems?

  4. If you created a new partition in the previous exercises,
    check it with
    fsck
    and observe the
    output:

    $
    fsck -f /dev/
    partition
  5. Check on the status of filesystems using
    df
    :

    $
    df -h
    1. How does the
      -h
      flag assist you with
      interpreting the results?

    2. Are any of your filesystems nearly full?

    3. Which are underutilized?

  6. As root, get a top-level view of disk usage by user using
    du
    :

    $
    du -s /home/*

    Are there any surprises?

  7. How could you use
    sort
    to make the output
    from the previous exercise more useful?

  8. Review
    /etc/fstab
    . Be sure you can name
    all six fields and their order as well as describe their
    function.

  9. Examine the output of the
    mount
    command
    without options. Compare the output with the contents of
    /etc/fstab
    .

  10. If you created a new partition in the previous exercises,
    mount it on
    /mnt/new
    or some other location of
    your choosing:

    $
    mkdir /mnt/new
    $
    mount /dev/
    partition
    /mnt/new
    $
    df /mnt/new
    1. Did the filesystem mount correctly? Can you store files on
      it?

    Next, unmount it:

    $
    umount /dev/
    partition
    /mnt/new

    Add a line to
    /etc/fstab
    for the new
    partition:

    /dev/partition  /mnt/new   ext3   defaults   1 2
  11. Test the quotas by setting them low for a particular user, and
    then start adding files as that user until the quota is exceeded.
    What is the observable consequence of exceeding the quota?

  12. Practice converting these file modes from octal to symbolic
    form:

    1. 0777

    2. 0754

    3. 0666

    4. 1700

    5. 7777

  13. Practice converting these file modes from symbolic to octal
    form. You can assume that
    x
    bits
    are set under SUID, SGID, and sticky bits:

    1. -rwxr-xr-x

    2. -r--r--r--

    3. -rwsrwsrwx

    4. -rw-rw---t

    5. -rws-w--w-

  14. Create temporary files and use
    chmod
    with
    both symbolic and numeric mode modifications. Include SUID, SGID,
    and sticky bits.

  15. As
    root
    , create temporary files and use
    chown
    to modify user ownership and group
    ownership.

  16. Use
    chgrp
    to modify group ownership on
    the temporary files created in the previous exercise.

  17. Create a temporary file and links as follows:

    $ touch a_file
    $ ln -s a_file an_slink
    $ ln a_file an_hlink

    Now verify that the file and the hard link indeed share an
    inode and that the symbolic link points to the original file:

    $ ls -li a_file an_slink an_hlink
  18. Review the latest version of the FHS at
    http://www.pathname.com/fhs/
    .

  19. Examine your filesystem. Does it match the FHS? If you find
    discrepancies, is it clear why they don’t?

  20. Use
    which
    to check on the location of
    executable files.

  21. Use
    find
    to search for
    bash
    :

    $ find / -name bash

    Now use
    locate
    for the same file:

    $ locate bash

    How are the results different? Describe a context in which
    each command would be useful.

  22. Update your
    locate
    database using
    updatedb
    . Note the amount of time this command
    takes and the resources it consumes on your system.

Chapter 9. Exam 101 Practice Test

This chapter will give you an idea of what kinds of questions
you can expect to see on the LPI 101 test. All questions are either
multiple-choice single answer, multiple-choice multiple answer, or fill in
the blank.

The questions are not designed to trick you; they are designed to test
your knowledge of the Linux operating system.

As of April 1, 2009, the exam weights for each LPI exam have been
standardized to 60 weights. This means that if an Objective has a weight of
2, there will be 2 questions on the test about items under that
Objective.

The answers for these sample questions are at the end of the
chapter.

Questions
  1. What kind of hardware is represented by the device name
    /dev/hda
    ?

    1. Sound Card

    2. Modem

    3. IDE Hard Drive

    4. SCSI Hard Drive

    5. SATA Hard Drive

  2. What file should you query to determine whether there is an IRQ
    conflict on your system?

    1. /proc/ioports

    2. /proc/interrupts

    3. /proc/cpuinfo

    4. /proc/meminfo

    5. /proc/irqstatus

  3. Which of the following are arguments you can pass to the kernel
    at boot time to tell it to start in runlevel 1 (single-user
    mode)?

    1. one

    2. 1

    3. safe

    4. single

    5. user

  4. Which process is referred to as the “mother of all processes”
    and always has PID 1?

    1. mother

    2. admin

    3. administrator

    4. init

    5. bios

  5. Which logfile should you examine for information about the
    hardware that the kernel initialized at boot time?

    1. /var/log/syslog

    2. /var/log/messages

    3. /var/log/lastlog

    4. /var/log/wtmp

    5. /var/log/cron

  6. If you want to change your system’s default boot device from the
    hard drive to the CD-ROM drive, where would you make that
    configuration change?

    1. The file
      /boot/grub/grub.conf

    2. The file
      /etc/lilo.conf

    3. An argument passed to the kernel at boot time

    4. The BIOS

    5. The file
      /etc/inittab

  7. What command line would reboot a running Linux system
    immediately, forcing an
    fsck
    of every drive on
    reboot?

    1. /sbin/shutdown –r –F now

    2. /sbin/shutdown –h –F now

    3. /sbin/shutdown

    4. /sbin/shutdown –r –f now

    5. /sbin/shutdown –t –f

  8. Which of the following are valid ways to interactively switch a
    running system to runlevel 3?

    1. chrunlevel 3

    2. runlevel 3

    3. init 3

    4. telinit 3

    5. init -3

  9. If you have created your own script that you wish to run every
    time your system boots, but it must run after all other processes have
    completed, where is the best place to reference it?

    1. /etc/inittab

    2. /etc/rc.d/rc.sysinit

    3. A symlink beginning with
      S
      in
      /etc/rc.d/rc5.d/

    4. /etc/rc.d/rc.local

    5. A symlink beginning with
      K
      in
      /etc/rc.d/rc5.d/

  10. Which command is used to display the current mounted partitions,
    their mount points, and the available free space on each?

    1. du

    2. df

    3. fdisk

    4. fsck

    5. mount

  11. Which partition is designed to hold data that changes often and
    is writable by all users?

    1. /var

    2. /home

    3. /tmp

    4. /opt

    5. /sys

  12. What does MBR stand for?

    1. Main Booting Runlevel

    2. Main Block Record

    3. Master Boot Record

    4. Master Block Record

    5. Master Boot Resource

  13. Which of the following lines in
    /boot/grub/grub.conf
    would tell GRUB to use
    the first partition of the first hard drive as the root
    partition?

    1. root (hd0,0)

    2. boot (hd0,0)

    3. root (hd1,1)

    4. boot (hd1,1)

    5. root (hd1,0)

  14. What file contains a list of directories that are searched to
    find shared libraries when a binary program is executed?

    1. /etc/loader.conf

    2. /etc/library/conf

    3. /etc/ld.so.cache

    4. /etc/ld.so.conf

    5. /etc/ld.conf

  15. For distributions that use the Debian package management system,
    what command will download and update all installed packages to the
    latest available version?

    1. apt-get install

    2. apt-cache update

    3. apt-get update

    4. apt-cache install

    5. dpkg –i

  16. If I download a
    .deb
    package (
    package
    .deb
    ) and wish to install it, what’s the
    best command to use?

    1. dpkg –i package.deb

    2. apt-get install package.deb

    3. apt install package.deb

    4. dpkg package.deb

    5. None of the above

  17. For distributions that use the Red Hat package management
    system, what command will list all packages currently
    installed?

    1. rpm –qa

    2. rpm –i

    3. rpm –Uvh

    4. rpm –list

    5. rpm –all

  18. For distributions that use the Red Hat package management
    system, what command will download and update all installed packages
    to the latest available version?

    1. yum update

    2. yum install

    3. yum config

    4. yum list available

    5. yum download

  19. What option(s) to
    rpm
    will instruct
    rpm
    to run a verification check on all packages
    installed on the system?

    1. rpm –verify –all

    2. rpm –Va

    3. rpm –qa

    4. rpm –check

    5. rpm –c

  20. What command is used to display a list of directories the shell
    will search in to find a command that has been entered?

    1. show $MYPATH

    2. echo $PATH

    3. echo $MYPATH

    4. setenv

    5. set $PATH

  21. Which file(s) does the bash shell read at login to set
    environment variables?

    1. /etc/bashrc

    2. ~/.bashrc

    3. ~/.bash_profile

    4. All of the above

    5. None of the above

  22. What commands can be used to view a list of the last commands
    typed into the shell?

    1. history



    2. All of the above

    3. None of the above

  23. If my current directory is
    /opt
    and I wish to run the command
    /opt/runme
    , what command(s) could I type
    (assuming
    /opt
    is
    not
    in your
    $PATH
    )?

    1. /opt/runme

    2. ./runme

    3. runme

    4. opt/runme

    5. ~/runme

  24. Which of the following commands will redirect the standard
    output of
    /bin/ls
    to
    /dev/null
    , while allowing standard error to
    display on the screen?

    1. /bin/ls > /dev/null 2>
      /dev/screen

    2. /bin/ls 1> /dev/null

    3. /bin/ls > /dev/null

    4. /bin/ls > /dev/null
      2>&1

    5. /bin/ls 2> /dev/null
      1>&2

  25. Which of the following command(s) will display the first 5 lines
    of the file
    /etc/passwd
    ?

    1. cat -5 /etc/passwd

    2. more -5 /etc/passwd

    3. head -5 /etc/passwd

    4. cat /etc/passwd | head -5

    5. cat /etc/passwd | more -5

  26. Which commands can be used to perform a search and replace on a
    file or a text stream?

    1. sed

    2. tr

    3. search

    4. cat

    5. more

  27. What command(s) can be used to copy data to and from raw
    devices, bypassing the filesystem?

    1. cp

    2. tar

    3. dd

    4. mv

    5. sed

  28. What option can be passed to
    /bin/ls
    to display every file in a
    directory that ends in
    .txt
    ?

    1. ls +.txt

    2. ls *.txt

    3. ls * txt

    4. ls [txt]

    5. ls *txt*

  29. What option can be passed to
    /bin/ls
    to display every file that starts
    with the letters
    a
    ,
    b
    , or
    c
    ?

    1. ls abc*

    2. ls a*b*c*

    3. ls ^abc

    4. ls [abc]+

    5. ls [abc]*

  30. Which file extensions are common for files or directories that
    have been concatenated with
    tar
    and then
    compressed with
    bzip2
    ?

    1. .tar.bz2

    2. .tbz2

    3. .tbz

    4. All of the above

    5. None of the above

  31. What device should you redirect output to if you do not want to
    see it or save it?

    1. /dev/zero

    2. /dev/nothing

    3. /dev/empty

    4. /dev/null

    5. /dev/bitbucket

  32. Which of the following commands would list the contents of the
    directory
    /tmp
    , store that list in the file
    /root/tmp.txt
    , and display the
    list a screen at a time?

    1. ls –l /tmp | tee /root/tmp.txt |
      more

    2. ls –l /tmp | xargs /root/tmp.txt |
      more

    3. ls –l /tmp | more | tee
      /root/tmp.txt

    4. tee /root/tmp.txt | ls –l /tmp |
      more

    5. more /tmp | tee /root/tmp.txt

  33. What character is used after a command line to indicate that the
    command should run in the background and return shell control to the
    user?

    1. *

    2. +

    3. &


    4. .

  34. What command is used at the beginning of a command line to
    detach the process from a terminal, allowing it to continue running
    after the user has logged out?

    1. hangup

    2. detach

    3. nohup

    4. background

    5. bg

  35. What command will display a full-screen, updated list of all
    running processes?

    1. kill

    2. ps

    3. list

    4. top

    5. free

  36. If a running process is not responding to a standard terminate
    signal from the
    /bin/kill
    command, what option
    can you pass to force the process to terminate immediately?

    1. kill -1

    2. kill --HUP

    3. kill --stop

    4. kill -9

    5. kill --now

Other books

We are Wormwood by Christian, Autumn
Never Eighteen by Bostic, Megan
A History of the Future by Kunstler, James Howard
Dark Avenging Angel by Catherine Cavendish
Sweet One (Titan Book 8) by Cristin Harber