Read LPI Linux Certification in a Nutshell Online
Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger
Tags: #Reference:Computers
This chapter 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 Exam 102. The exercises can be particularly useful
if you’re not accustomed to more advanced Linux administration, and they
should help you better prepare for the exam. To complete the exercises, you
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
.
Why is it dangerous to have “.” (the current working
directory) in your $PATH variable?
What characteristic of a
bash
variable
changes when the variable is exported?
What configuration files will
bash
read
when a shell is started?
Describe the concept of shell aliases.
When is a shell function more suitable than a shell
alias?
Describe the function of
/etc/profile
.
What must the author of a new script file do to the file’s
mode in order to make it executable?
How does the shell determine what interpreter to execute when
starting a script?
How can a shell script use return values of the commands it
executes?
What are some common open source databases available on Linux
systems?
Describe the common MySQL datatypes and when they are
appropriate to use.
What is the difference between a join and a left join in a SQL
query?
Using
bash
, enter the
export
command and the
set
command. Which set of variables is a subset of the other? What is
the difference between the variables reported by
export
and those reported by
set
? Finally, enter
which
export
. Where is the
export
command
located?
Examine
/etc/profile
. How is the defaultumask
set? What customizations
are done in the file for system users?
Create a simple
bash
script using the#!/bin/bash
syntax, set the
executable mode bits, and execute the shell. If it runs correctly,
add errors to see the diagnostic messages. Have the script report
both exported and nonexported variables. Verify that the nonexported
variables do not survive the startup of the new shell.
Create some bash aliases in your current shell. Start a new
shell by running the command
bash
in your
current shell. Do your aliases work in this child shell? Why or why
not?
Create a MySQL table structure that could be used to store the
fields in the file
/etc/passwd
.
Write a shell script to parse this file, one line at a time, and
call the
mysql
command-line program to insert
the users defined in
/etc/passwd
into your table. Once this is
complete, write a SQL query to list all usernames that have a shell
of
/bin/bash
.
What is the main X Windows configuration file?
What are the troubleshooting steps you need to take when X
Windows won’t start?
How can you switch between desktop environments (for example,
running KDE instead of Gnome)?
What are some common functions that can be used to assist
visually impaired users with using X Windows?
What file would you edit to make an application run every time
you log into X Windows?
Boot your system into runlevel 3. Log in as root and type the
command
/usr/bin/startx
. Exit X Windows and
examine the logfile
/var/log/Xorg.0.log
. What specific things
does this file tell you about your graphical environment? From this
file, can you determine what video card you have and what
resolutions it supports?
Exit X Windows and use the
/sbin/init
command to change your system to runlevel 5. Once X Windows starts,
hit the key combination Ctrl-Alt-backspace. What happens to X
Windows? Why does this happen?
What would happen to a user account if the default
shell were changed to
/bin/false
?
When a new account is created with
useradd
-m
, what files are used to populate the new home
directory?
Compare and contrast the execution of
/etc/profile
and
/etc/bashrc
.
Compare and contrast
cron
and
at
.
Is there a
cron
command?
Describe the format of a
crontab
file,
describing each of the six fields.
What does an asterisk mean in
crontab
fields 1 through 5?
Add a user with
useradd
, including a new
home directory populated with files from
/etc/skel
.
Add a group with
groupadd
.
Use
usermod
to add your new user to the
new group.
Set the new user’s password using
passwd
.
Log into the new account, and use
newgrp
to change to the new group.
Delete the new group and user (including home directory) using
groupdel
and
userdel
.
Examine the contents of
/etc/skel
. How
similar are they to your own home
directory
?
Review the contents of
/etc/profile
and
/etc/bashrc
.
Add an entry in your personal
crontab
file to perform a task, such as sending you an email message.
Confirm that the action occurs as expected. Experiment with the five
time specifiers.
Schedule a command in the future with
at
.
How is
at
different from
cron
?
Why is accurate time important on a Linux system? What
options exist to keep time in sync?
Describe the difference between system time and the hardware
clock.
How is time stored on a Linux system? How is the time zone
used to modify this value?
What two things does the
syslogd
server
use to categorize log entries? What are the limitations of this
format?
Give some examples of what kinds of messages you would expect
to see in
/var/log/messages
.
What does
lpd
do to handle incoming print
jobs destined for empty print queues?
Describe the kinds of information included in
/etc/printcap
.
What is the function of a print filter?
What does the
-P
option specify to the
print commands?
When is it useful to pipe into the standard input of
lpr
instead of simply using a filename as an
argument?
How is the Ghostscript program used in printing to a
non-PostScript printer?
What filter is used on a Linux system to print to remote
printers on Windows clients?
What are the common Mail Transport Agents (MTAs) used on Linux
systems? Give a brief description of each.
What command would you use to view the contents of the mail
queue on a system running sendmail? What command would you use to
force a resend of that queue?
What is the easiest way to forward all email coming into an
account to another email address?
What file is used to maintain email aliases for local users?
Describe the maintenance procedure for this file.
Run the
date
command on your system. Is
your system clock accurate? Run the command
ntpd
–gnq
. Did you system time change? By how much?
Add this line:
*.* /var/log/everything
to
/etc/syslog.conf
and
restart
syslog
. Now run
tail –f
/var/log/everything
. What kinds of things do you see? How
often are events written to this log?
Add thelocal5
facility to
your configuration. Use
logger
to write to your
new logfile, and verify its contents. Compare your log entries with
those in
/var/log/messages
.
Examine
/etc/logrotate.conf
. What happens
after
/var/log/messages
is rotated?
On a system with an existing printer, examine
/etc/printcap
. Which print filter is used for
the printer? Which queue or queues are directed at the
printer?
Check the printer status with
lpq -Pprinter
and
lpc
status
. Print to the queue using
lpr
-Pprinter file
.
Examine
/var/spool/lpd
for the spool
directory of your print queue. Examine the files you find
there.
Determine what MTA is installed on your system. Is it
listening on TCP port 25? How can you tell?
Type the command
telnet localhost 25
.
What do you see?
Type the command
echo “test” | mail root
.
Now type
tail /var/log/maillog
. Was your mail
delivered? How can you tell?
Describe how the subnet mask affects the maximum
number of hosts that can be put on a TCP/IP network.
Name the three default address classes and the subnet masks
associated with them.
Identify the IPv4 private address ranges.
What are some advantages IPv6 has over IPv4?
The UDP protocol is said to be connectionless. Describe this
concept and its consequences for applications that use UDP.
What is a TCP port? Give some examples of common TCP ports and
the applications and protocols that use them.
What user command is frequently used to send ICMP messages to
remote hosts to verify those hosts’ connectivity?
Describe the contents and use of
/etc/hosts
.
In what configuration file are DNS servers listed? What is
intended if the local loopback address is included there on a
workstation?
Name two modes of the
netstat
command and
the program’s output in each case.
Describe why the
route
command is needed
for a single interface on a nonrouting workstation.
How does
traceroute
determine the
identities of intermediate gateways?
Describe the advantages and consequences of implementing
DHCP.
Examine your system’s TCP/IP configuration using
ifconfig eth0
or a similar command for your
network interface. Are you using DHCP? What type of subnet are you
running with? Is it a class A, B, or C address? Are you using a
private address? Experiment with taking the interface offline using
ifconfig eth0 down
and
ifconfig eth0
up
.
Examine the contents of
/etc/services
.
How many protocols do you recognize?
Use the
dig
command to locate information
from DNS servers about a domain name.
Examine your
/etc/hosts
file. How much
name resolution is accomplished in this file manually?
Examine your
/etc/resolv.conf
file. How
many DNS servers do you have avail
able
?
Execute
netstat -r
. How many routes are
reported? What are the routes to the local network and interface
for?
Use
traceroute
to examine the route to a
favorite website.