LPI Linux Certification in a Nutshell (37 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
3.27Mb size Format: txt, pdf, ePub
  1. What command can be used to kill processes by name, rather than
    process ID?

    1. killproc

    2. killname

    3. killall

    4. kill –name

    5. killpath

  2. Which command line would start the program
    /usr/bin/top
    with the highest priority
    possible?

    1. nice --20 /usr/bin/top

    2. nice 20 /usr/bin/top

    3. nice 19 /usr/bin/top

    4. nice -20 /usr/bin/top

    5. None of the above

  3. Which command is used to modify the priority of a process
    already running?

    1. nice

    2. renice

    3. priority

    4. chage

    5. ps

  4. Which command(s) would display every line in
    /tmp/file.txt
    that begins with the letter
    h
    and ends with the letter
    t
    ?

    1. grep "^h.+t$" /tmp/file.txt

    2. grep –E "^h.+t$" /tmp/file.txt

    3. grep –E "$h.+t^" /tmp/file.txt

    4. grep –E "$ht^" /tmp/file.txt

    5. grep –E "^h.*t$" /tmp/file.txt

  5. Which command(s) would display every line in
    /tmp/file.txt
    that contains at least one
    letter of the alphabet?

    1. grep " [a-zA-Z] " /tmp/file.txt

    2. grep " [:alpha:] " /tmp/file.txt

    3. grep " [:letters:] "
      /tmp/file.txt

    4. grep " (a-zA-Z) " /tmp/file.txt

    5. None of the above

  6. In the
    vi
    editor, what command sequence
    given in command mode will make a copy of the current line?

    1. yyp

    2. cp

    3. yp

    4. ccp

    5. None of the above

  7. In the
    vi
    editor, what command sequence
    given in command mode will save the current file and quit the
    editor?

    1. :qw

    2. :wq

    3. :WQ

    4. :pq

    5. None of the above

  8. In the
    vi
    editor, what command sequence
    given in command mode will quit a file without saving, even if changes
    have been made?

    1. :q

    2. :q1

    3. :q!

    4. :w

    5. :w!

  9. Which of the following are examples of journaling
    filesystems?

    1. ext2

    2. ext3

    3. xfs

    4. reiserfs

    5. vfat

  10. What command will create an ext3 partition on the first
    partition of the first SCSI hard drive?

    1. mkfs –t ext3 /dev/sda1

    2. fdisk –t ext3 /dev/sda1

    3. fsck –t ext3 /dev/sda1

    4. mkfs –s ext3 /dev/hda1

    5. mkfs –t ext3 /dev/hda1

  11. What command is used to convert an existing ext2 partition
    (
    /dev/sda1
    ) to an ext3 (journaled)
    partition?

    1. tune2fs –j /dev/sda1

    2. dumpe2fs –j /dev/sda1

    3. fsck –j /dev/sda1

    4. mkfs.ext2 –j /dev/sda1

    5. None of the above

  12. What command is used to display the number of free inodes on an
    ext2 or ext3 partition?

    1. tune2fs

    2. dumpe2fs

    3. showe2fs

    4. fsck

    5. fdisk

  13. Which file defines what partitions are mounted at boot
    time?

    1. /etc/partitions

    2. /etc/mount

    3. /etc/mtab

    4. /etc/fstab

    5. /etc/filesystems

  14. Which command will mount all partitions of type nfs defined in
    /etc/fstab
    ?

    1. mount –a –t nfs

    2. mount –a nfs –t

    3. mount –nfs

    4. mountall –nfs

    5. None of the above

  15. If you would like to give a normal (nonroot) user the ability to
    mount a device, what option should you define for that device in
    /etc/fstab
    ?

    1. mountable

    2. noroot

    3. user

    4. ok

    5. mount

  16. Which option to
    chmod
    would assign
    read/write permission to the file owner, read-only permission to the
    group owner, and read-only permission to everyone else?

    1. chmod 644 file.txt

    2. chmod 755 file.txt

    3. chmod 466 file.txt

    4. chmod 777 file.txt

    5. None of the above

  17. Which option to
    umask
    would set my default
    file permissions such that files are created with these permissions:
    user has read/write, group has read/write, and everyone else has read
    only?

    1. umask 002

    2. umask 022

    3. umask 200

    4. umask 220

    5. umask 775

  18. Which command can be used to quickly tell you if an executable
    command is in any directory defined in your
    $PATH
    environment variable?

    1. find

    2. locate

    3. which

    4. who

    5. what

  19. Which directory, according to the Filesystem Hierarchy Standard,
    is designed to hold essential system binaries?

    1. /sbin

    2. /bin

    3. /usr/bin

    4. /opt/bin

    5. /usr/local/bin

  20. According to the Filesystem Hierarchy Standard, what directory
    (or directories) must hold the system kernel?

    1. /boot

    2. /

    3. /opt

    4. /sbin

    5. /kernel

  21. What command is used to maintain the filesystem index that the
    command
    /usr/bin/locate
    searches?

    1. update

    2. updatelocate

    3. locate –update

    4. updatedb

    5. update -db

Answers
  1. c.
    IDE Hard Drive

  2. b.
    /proc/interrupts

  3. b.
    1
    AND
    d.
    single
    .
    Both answers are correct.

  4. d.
    init

  5. b.
    /var/log/messages
    . This is the default logfile
    that syslogd saves to.

  6. d.
    The BIOS

  7. a.
    /sbin/shutdown
    –r –F now
    . This may seem like a small detail to have to
    remember, but this is an important command, and you should have its
    options memorized, particularly the difference between
    –F
    (force
    fsck
    on reboot)
    and
    –f
    (skip
    fsck
    on reboot).

  8. c.
    init
    3
    AND
    d.
    telinit
    3
    . Both answers are
    correct.

  9. a.
    A symlink beginning with
    S
    in
    /etc/rc.d/rc5.d/
    AND
    b.
    /etc/rc.d/rc.local
    . Both answers are correct.
    Note that most distributions have an
    /etc/rc.d/rc.local
    file that runs after the
    default runlevel scripts are run.

  10. b.
    df

  11. c.
    /tmp
    .
    If the question was just about a partition where data changed often,
    that would be both
    /tmp
    and
    /var
    . But
    /tmp
    is the only
    partition that needs to be writable by all users.

  12. c.
    Master Boot Record

  13. a.
    root
    (hd0,0)
    . GRUB (the Grand Unified Boot Loader) starts
    counting drives and partitions at 0, so the first partition on the
    first drive is 0,0.

  14. d.
    /etc/ld.so.conf
    . When modifications are made to
    this file, the command
    /sbin/ldconfig
    must be
    run.

  15. c.
    apt-get
    update

  16. a.
    dpkg –i package.deb

  17. a.
    rpm
    –qa

  18. a.
    yum
    update

  19. a.
    rpm –verify
    –all
    AND
    b.
    rpm –Va
    . Both of these commands are
    equivalent.

  20. b.
    echo
    $PATH

  21. d.
    All of the above. Remember
    that the ~ key indicates a user’s home directory.

  22. d.
    All of the above. The
    history
    command will list the last commands run
    (how many commands are listed is configurable), will
    allow you to search the history by keyword, and
    cycles through the last command typed in the order in which they were
    typed.

  23. a.
    /opt/runme
    AND
    b.
    ./runme

  24. b.
    /bin/ls 1>
    /dev/null
    AND
    c.
    /bin/ls > /dev/null
    . The syntax
    >
    and
    1>
    are
    equivalent. If you don’t redirect
    STDERR
    , it will
    display to the screen by default.

  25. c.
    head -5
    /etc/passwd
    AND
    d.
    cat /etc/passwd | head -5

  26. a.
    sed
    AND
    b.
    tr

  27. b.
    tar
    AND
    c.
    dd
    . The
    tar
    command is often used to talk directly to
    tape devices (
    tar –xvf /dev/st0
    ), and
    dd
    can be used to make copies of devices. For
    example, to create a raw image of a 1.44 MB floppy disk, use
    dd if=/dev/fd0 of=/tmp/floppy.img

  28. c.
    ls *.txt
    . Remember that the syntax for file
    globbing is different from the syntax for regular expressions. In
    particular, the behavior of the asterisk (*) is vastly different
    between the two.

  29. e.
    ls
    [abc]*
    . Another file globbing example.

  30. d.
    All of the above. Since
    file extensions are not really necessary in the Linux world, there
    isn’t one single standard that covers them all. However,
    tar.bz2
    ,
    tbz2
    , and
    .tbz
    are all examples of file
    extensions you might see to indicate that a file is tarred and
    bzipped.

  31. d.
    /dev/null
    . Also referred to as the “bit
    bucket.”

  32. a.
    ls
    –l /tmp | tee /root/tmp.txt | more
    . It’s
    important to remember the order of commands when you are piping
    multiple commands together, especially when the
    tee
    command is involved.

  33. c.
    &

  34. c.
    nohup
    . The
    nohup
    command is
    usually paired with
    &
    to put a process in the
    background and detach it from the current terminal. For example,
    nohup /opt/long_process.sh &
    would start the
    command
    /opt/long_process.sh
    and allow me to log
    out while the process remains running.

  35. d.
    top
    .
    There are many ways to view processes on a machine, but the
    top
    command is probably one of the most useful
    commands, giving you sort ability and process interaction
    capability.

  36. d.
    kill
    -9
    . Note that this might not kill a process that is waiting
    on disk I/O or some other kind of blocking, noninterruptible
    process.

  37. c.
    killall

  38. a.
    nice --20
    /usr/bin/top
    . This is a tricky one. First, you have to
    remember that priority values range from -20 (highest priority) to 19
    (lowest priority). So if I want to pass the highest priority to a
    process, I have to pass
    -20
    . However, options to
    commands start with the
    -
    (dash) character, so I
    need to make sure I type 2 dashes, the first to indicate that the next
    argument is an option, and the second to indicate that I’m passing a
    negative number to the
    nice
    command.

  39. b.
    renice

  40. e.
    grep –E "^h.*t$" /tmp/file.txt
    . This
    command literally means, “Search for the extended regular expression
    that matches
    h
    as the first character, followed
    by zero or more of any other character, and having
    t
    as the last character.” The
    –E
    option is required because the
    presence of the
    .*
    makes this an extended regular
    expression. The answer in
    a.
    is
    close, but the syntax
    .+
    means “match 1 or more
    characters of any kind.” The regular expression in
    a.
    would not match the line “ht”, whereas the
    regular expression in
    e.
    would.

  41. a.
    grep " [a-zA-Z] " /tmp/file.txt
    AND
    b.
    grep "
    [:alpha:] " /tmp/file.txt
    . Become familiar with the sets
    that are defined with the syntax
    [:setname:]
    ;
    they are very useful in advanced regular expressions. You can see a
    complete list of them in the manpage for
    grep
    .

  42. a.
    yyp
    . An easy way to remember this:
    Yank-Yank-Put.

  43. b.
    :wq
    . The colon brings up the command entry
    line at the bottom of the
    vi
    screen,
    w
    stands for write, and
    q
    stands for quit.

  44. c.
    :q!
    . The
    vi
    editor has
    many, many commands, but if you become familiar with a few dozen,
    you’ll be able to accomplish 99 percent of what you will commonly need
    to accomplish in
    vi
    .

  45. b.
    ext3 AND
    c.
    xfs AND
    d.
    reiserfs. Ext3 is ext2 with journaling
    support added. Vfat is a Microsoft filesystem.

  46. a.
    mkfs –t ext3
    /dev/sda1
    . The command
    mkfs.ext3
    is
    equivalent to
    mkfs –t ext3
    .

  47. a.
    tune2fs –j
    /dev/sda1
    . Technically, the command listed in
    d.
    (
    mkfs.ext2 –j
    /dev/sda1
    ) will create an ext3 partition on
    /dev/sda1
    , but it will destroy whatever partition
    is there in the process.

  48. b.
    dumpe2fs

  49. d.
    /etc/fstab

  50. a.
    mount –a –t
    nfs

  51. c.
    user

  52. a.
    chmod 644 file.txt

  53. b.
    umask
    022

  54. c.
    which

  55. a.
    /sbin

  56. a.
    /boot
    AND
    b.
    /
    . Both
    directories are correct. Most Linux distributions will store the
    kernel in
    /boot
    ; the presence of a kernel in
    /
    is deprecated.

  57. d.
    updatedb

Other books

Necessary as Blood by Deborah Crombie
Date Rape New York by Janet McGiffin
ATasteofRome by Lucy Felthouse
Dolly by Susan Hill
Celtic Fairy Tales by Joseph Jacobs
The Unknown Masterpiece by Honore de Balzac