Read LPI Linux Certification in a Nutshell Online
Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger
Tags: #Reference:Computers
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?
Name the directories that must be within the
/
partition.
Describe the differences between physical disks, partitions,
and filesystems.
What is a journaling filesystem and how does it differ from a
nonjournaling filesystem?
What is a
swap
partition used for? Why
not just use swap files?
What kind of output will
df -h
yield?
Describe a common situation that is likely to cause the
automatic use of
fsck
on the next system
boot.
Name the fields in
/etc/fstab
.
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.
If thero
option is used in
/etc/fstab
for
/usr
, what
limitation is placed on that filesystem?
Compare and contrast hard and soft quota limits.
Name the symbolic permission that is equivalent to
0754.
Describe a situation that requires the SUID permission. What
ramifications does this permission imply?
How do you determine what binaries on your system have the
SUID bit set?
Compare and contrast the differences between hard and symbolic
links.
Name the document to which Linux directory assignments should
conform.
Compare and contrast the differences between the
locate
and
find
commands.
As root, run
fdisk
on your main hard
drive and enter thep
command to
print the partition table. Examine your system’s configuration and
make sure you understand everything you see. Enter thel
command and review the many partition
types Linux can accommodate. Enter theq
command to quit without saving
changes.
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
.
Use a pager to examine
/var/log/messages
and search for entries made by
fsck
. Did it
find any problems?
If you created a new partition in the previous exercises,
check it with
fsck
and observe the
output:
$fsck -f /dev/
partition
Check on the status of filesystems using
df
:
$df -h
How does the
-h
flag assist you with
interpreting the results?
Are any of your filesystems nearly full?
Which are underutilized?
As root, get a top-level view of disk usage by user using
du
:
$du -s /home/*
Are there any surprises?
How could you use
sort
to make the output
from the previous exercise more useful?
Review
/etc/fstab
. Be sure you can name
all six fields and their order as well as describe their
function.
Examine the output of the
mount
command
without options. Compare the output with the contents of
/etc/fstab
.
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
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
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?
Practice converting these file modes from octal to symbolic
form:
0777
0754
0666
1700
7777
Practice converting these file modes from symbolic to octal
form. You can assume thatx
bits
are set under SUID, SGID, and sticky bits:
-rwxr-xr-x
-r--r--r--
-rwsrwsrwx
-rw-rw---t
-rws-w--w-
Create temporary files and use
chmod
with
both symbolic and numeric mode modifications. Include SUID, SGID,
and sticky bits.
As
root
, create temporary files and use
chown
to modify user ownership and group
ownership.
Use
chgrp
to modify group ownership on
the temporary files created in the previous exercise.
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
Review the latest version of the FHS at
http://www.pathname.com/fhs/
.
Examine your filesystem. Does it match the FHS? If you find
discrepancies, is it clear why they don’t?
Use
which
to check on the location of
executable files.
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.
Update your
locate
database using
updatedb
. Note the amount of time this command
takes and the resources it consumes on your system.
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.
What kind of hardware is represented by the device name
/dev/hda
?
Sound Card
Modem
IDE Hard Drive
SCSI Hard Drive
SATA Hard Drive
What file should you query to determine whether there is an IRQ
conflict on your system?
/proc/ioports
/proc/interrupts
/proc/cpuinfo
/proc/meminfo
/proc/irqstatus
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)?
one
1
safe
single
user
Which process is referred to as the “mother of all processes”
and always has PID 1?
mother
admin
administrator
init
bios
Which logfile should you examine for information about the
hardware that the kernel initialized at boot time?
/var/log/syslog
/var/log/messages
/var/log/lastlog
/var/log/wtmp
/var/log/cron
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?
The file
/boot/grub/grub.conf
The file
/etc/lilo.conf
An argument passed to the kernel at boot time
The BIOS
The file
/etc/inittab
What command line would reboot a running Linux system
immediately, forcing an
fsck
of every drive on
reboot?
/sbin/shutdown –r –F now
/sbin/shutdown –h –F now
/sbin/shutdown
/sbin/shutdown –r –f now
/sbin/shutdown –t –f
Which of the following are valid ways to interactively switch a
running system to runlevel 3?
chrunlevel 3
runlevel 3
init 3
telinit 3
init -3
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?
/etc/inittab
/etc/rc.d/rc.sysinit
A symlink beginning with
S
in
/etc/rc.d/rc5.d/
/etc/rc.d/rc.local
A symlink beginning with
K
in
/etc/rc.d/rc5.d/
Which command is used to display the current mounted partitions,
their mount points, and the available free space on each?
du
df
fdisk
fsck
mount
Which partition is designed to hold data that changes often and
is writable by all users?
/var
/home
/tmp
/opt
/sys
What does MBR stand for?
Main Booting Runlevel
Main Block Record
Master Boot Record
Master Block Record
Master Boot Resource
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?
root (hd0,0)
boot (hd0,0)
root (hd1,1)
boot (hd1,1)
root (hd1,0)
What file contains a list of directories that are searched to
find shared libraries when a binary program is executed?
/etc/loader.conf
/etc/library/conf
/etc/ld.so.cache
/etc/ld.so.conf
/etc/ld.conf
For distributions that use the Debian package management system,
what command will download and update all installed packages to the
latest available version?
apt-get install
apt-cache update
apt-get update
apt-cache install
dpkg –i
If I download a
.deb
package (package
.deb
) and wish to install it, what’s the
best command to use?
dpkg –i package.deb
apt-get install package.deb
apt install package.deb
dpkg package.deb
None of the above
For distributions that use the Red Hat package management
system, what command will list all packages currently
installed?
rpm –qa
rpm –i
rpm –Uvh
rpm –list
rpm –all
For distributions that use the Red Hat package management
system, what command will download and update all installed packages
to the latest available version?
yum update
yum install
yum config
yum list available
yum download
What option(s) to
rpm
will instruct
rpm
to run a verification check on all packages
installed on the system?
rpm –verify –all
rpm –Va
rpm –qa
rpm –check
rpm –c
What command is used to display a list of directories the shell
will search in to find a command that has been entered?
show $MYPATH
echo $PATH
echo $MYPATH
setenv
set $PATH
Which file(s) does the bash shell read at login to set
environment variables?
/etc/bashrc
~/.bashrc
~/.bash_profile
All of the above
None of the above
What commands can be used to view a list of the last commands
typed into the shell?
history
All of the above
None of the above
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
)?
/opt/runme
./runme
runme
opt/runme
~/runme
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?
/bin/ls > /dev/null 2>
/dev/screen
/bin/ls 1> /dev/null
/bin/ls > /dev/null
/bin/ls > /dev/null
2>&1
/bin/ls 2> /dev/null
1>&2
Which of the following command(s) will display the first 5 lines
of the file
/etc/passwd
?
cat -5 /etc/passwd
more -5 /etc/passwd
head -5 /etc/passwd
cat /etc/passwd | head -5
cat /etc/passwd | more -5
Which commands can be used to perform a search and replace on a
file or a text stream?
sed
tr
search
cat
more
What command(s) can be used to copy data to and from raw
devices, bypassing the filesystem?
cp
tar
dd
mv
sed
What option can be passed to
/bin/ls
to display every file in a
directory that ends in
.txt
?
ls +.txt
ls *.txt
ls * txt
ls [txt]
ls *txt*
What option can be passed to
/bin/ls
to display every file that starts
with the letters
a
,
b
, or
c
?
ls abc*
ls a*b*c*
ls ^abc
ls [abc]+
ls [abc]*
Which file extensions are common for files or directories that
have been concatenated with
tar
and then
compressed with
bzip2
?
.tar.bz2
.tbz2
.tbz
All of the above
None of the above
What device should you redirect output to if you do not want to
see it or save it?
/dev/zero
/dev/nothing
/dev/empty
/dev/null
/dev/bitbucket
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?
ls –l /tmp | tee /root/tmp.txt |
more
ls –l /tmp | xargs /root/tmp.txt |
more
ls –l /tmp | more | tee
/root/tmp.txt
tee /root/tmp.txt | ls –l /tmp |
more
more /tmp | tee /root/tmp.txt
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?
*
+
&
–
.
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?
hangup
detach
nohup
background
bg
What command will display a full-screen, updated list of all
running processes?
kill
ps
list
top
free
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?
kill -1
kill --HUP
kill --stop
kill -9
kill --now