Read LPI Linux Certification in a Nutshell Online
Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger
Tags: #Reference:Computers
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.
Describe the boot process on a PC, and identify the
order in which control passes as a system boots.
Name three files in the
/proc
filesystem
that contain information on system resource allocations.
Which of the following SCSI interfaces has the fastest data
transfer rates: SCSI-1, SCSI-2, Ultra SCSI, or Fast-Wide
SCSI?
What is the naming convention in
/dev
for
the different hard disk interfaces?
What command is used to obtain USB information on a Linux
system?
What driver is used for USB hard drives?
What is your default runlevel? How can you tell?
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.
Examine the enabled serial and parallel ports. Can you
manually configure the interrupts and I/O ports assigned to
them?
Examine your modem and sound external interfaces on your PC.
Are the devices built into your motherboard or independent expansion
cards?
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?
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?
Examine the kernel’s interrupt assignments by executing
cat /proc/interrupts
. Are your devices reported
correctly? Are any devices sharing interrupts?
Review output from
cat /proc/dma
and
cat /proc/ioports
.
Create a list of all installed PCI devices using
lspci
. Note the devices built into your
motherboard.
Run
lsmod
and match the loaded kernel
modules with hardware in your system.
Connect a USB device (mouse, printer, etc.) to your system.
Run
lsmod
to verify that the appropriate driver
loaded.
Run the
dmesg
command and go through the
hardware your kernel recognized at boot time.
Reboot the system and modify the grub boot line to boot into
single-user mode.
At the root prompt, type
kill 1
. What
happens? Why?
Why is the
/var
directory usually
located in a partition of its own?
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?
What is the recommended size for a swap partition, as a
function of the memory in a system?
Describe how to create a
tar
archive and
how its contents are extracted.
In general terms, describe the procedure used to compile and
install free or open source software from source code.
What is a shared library? How can you determine what library
dependencies exist in a compiled executable?
How does your system know where to look for shared
libraries?
Briefly describe the major functional modes of
rpm
.
How do you add additional repositories to
yum
?
What are the reasons to choose LILO over GRUB as a boot
loader, or vice versa?
Why might a Debian Linux administrator use
dpkg
-iG
instead of simply
dpkg -i
to
install a package?
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?
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?
Download a
tarball (from
http://sourceforge.net
, for
example), and install it on your system with the following
steps:
Unpack it using
tar -xzvf file
(or
tar –xjvf file
if it is compressed with
bzip2).
Configure it with
./configure
.
Build the software using
make
as
directed in the documentation.
Install the software using the instructions
provided.
Were there any difficulties with this procedure?
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)
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
.
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
.
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.
Describe the difference between shell variables and
environment variables.
Compare and contrast built-in and explicitly defined commands
and those found in$PATH
.
After a lengthy session of file manipulation on the command
line, what will
!ls
produce?
What files does
bash
read when you log
in?
Explain the notion of
pipes
as they refer
to shell capabilities, and illustrate using an example of two or
more filter programs.
Explain the
-p
option to
cp
and give an example of why it is
necessary.
Give two examples of files matched by the wildcard??[!1-5]
.
Name the three standard I/O streams and their
functions.
Give an example of the redirection operator,>
, and describe how the outcome would
be different using the>>
operator.
What process is the parent of all system processes? Give both
the PID and the program name.
Name three common utilities used for process
monitoring.
What happens to a typical daemon when it receivesSIGHUP
? How would the behavior be
different if it receivedSIGKILL
?
Compare and contrast background and foreground jobs, and state
the syntax to put a command in the background on the command
line.
What two classifications of characters make up regular
expressions?
How are the regular expressions[A-Z]*
and^[A-Z]*$
different?
What is the difference between executing:q
versus:q!
in
vi
?
What does it mean to put
vi
into
command mode
?
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
Was the behavior of the two
echo
commands identical?
If so, why? If not, why not?
What happened immediately after the
bash
command?
Which variable is an environment variable?
Continuing the previous exercise, press the up arrow until you
see the last
echo
command. Press the up arrow
again.
What do you see?
Why wasn’t it the
exit
command?
Press the up arrow again so that theexport
command is displayed. Add a
space andMYVAR2
so that the
line now looks like this:
$export MYVAR1 MYVAR2
What happens when you enter this command?
Still continuing the previous exercise, enter the command
!echo
. Does anything change as a result of the
revised
export
command?
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`
Execute this command on your system:
$cut -d: -f1 /etc/passwd | fmt -w 20 | head -1
What was displayed?
How many lines of output did you see? Why?
What was the width of the output? Why?
Execute the following
sed
substitution
command and explain why it might be used on
/etc/passwd
:
$sed 's/:[^:]*:/:---:/' /etc/passwd | less
Execute this command:
$cd /sbin ; ls -li e2fsck fsck.ext2
What is the significance of the first field of the
output?
Why is it identical for both listings?
Why are the file sizes identical?
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 .
Remove the directory created in the previous exercise, using
rmdir
and/or
rm
. Which
command can complete the task in a single step?
Explain when the wildcard{htm,html}
might be useful.
Give an example of how the wildcard*.[Tt][Xx][Tt]
could be used with
directory listings.
What can be said about filenames matched by the*.?
wildcard?
Experiment with redirecting the output of
ls
as follows:
$cp /etc/skel . 2> info.txt
How is the terminal output different than that observed in
Exercise 8?
What is written to
info.txt
?
Experiment with
ps, pstree
, and
top
to monitor active processes on your system.
Include
top
’s interactive commands.
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 theHUP
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 ofHUP
on Apache?
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?
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.
Use a simple regular expression with
grep
to find
bash
users in
/etc/passwd
.
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?
Determine the number of empty lines in
/etc/inittab
.
Use
vi
to create a text file. Enter
insert mode
withi
and insert text. Quit insert mode with
Esc and move around usingh
,j
,k
, andl
, then re-enter insert mode and add more
text. End the session withZZ.
cat
the file. Is it as expected?