Ch06 Solutions
Ch06 Solutions
6-1
Review Questions
1. Which of the following terms refers to a system service that does not run on a terminal?
a. Program
b. User Process
c. Daemon Process
d. Child Process
ANSWER: c
2. Which of the following statements are true? (Choose all that apply.)
a. A parent process may only have one child process
b. Each process is given a PPID that is used to uniquely identify it on the system
c. A child process may only have one parent process
d. All background processes have a PID and a job ID
ANSWER: c,d
3. Which of the following commands can quickly identify the child processes started by a
particular daemon?
a. top
b. lsof
c. ps
d. pstree
ANSWER: d
4. Which processes are regular users allowed to send kill signals to? _____
ANSWER: Their own processes only.
5. You have just run the ps aux command and notice that most daemons have an S in the
STAT column. What does this mean? _____
ANSWER: It indicates that they are sleeping (waiting for an event to occur).
6. What key can you press in the top command to send the process a signal?
6-2
a. s
b. k
c. R
d. N
ANSWER: b
7. What can you type at a command prompt to run the updatedb command in the
background? _____
ANSWER: updatedb&
8. Which of the following key combinations can you use to pause a foreground process such
that it may be send to the background with the bg command?
a. Ctrl+c
b. Ctrl+p
c. Ctrl+z
d. Ctrl+r
ANSWER: c
9. Which of the following kill commands may be used to send the second background job a
SIGINT?
a. kill -2 %2
b. kill -1 b 2
c. kill -9 %2
d. kill -15 2
ANSWER: a
10. If you do not specify the type of signal when using the kill or killall commands, which
signal is used by default?
a. SIGHUP
b. SIGINT
c. SIGKILL
d. SIGTERM
ANSWER: d
11. What command could you use change the priority of a process (PID=592) to run with the
highest priority? _____
ANSWER: renice -20 592 or renice n -20 592
12. What startup script is used to start the services associated with the network in SLES?
_____
6-3
ANSWER: /etc/init.d/network
13. Which directory stores links to the startup scripts for daemons that should be started in
runlevel 3?
a. /etc/init.d
b. /etc/init.d/rc3.d
c. /etc/init3.d
d. /etc/init.d/skeleton
ANSWER: b
14. You have a script that is used to remove temporary files and would like this script to run
on a daily basis. Which directory could you place this script in to have the cron daemon
execute it each day? _____
ANSWER: /etc/cron.daily
15. Which command could a regular user use to edit their crontab? _____
ANSWER: crontab -e
16. What lines would you add to your crontab to schedule the /bin/false command to run at
10:30am and 2:50pm from Monday to Friday? _____
ANSWER: 30 10 * * 1-5 /bin/false and 50 14 * * 1-5 /bin/false
17. Which command can you use to run the contents of the file cleanup at noon hour? _____
ANSWER: at noon f cleanup
18. Which command can you use to view at jobs that have been scheduled on your system?
a. at --view
b. atq
c. atrm
d. cron --view
ANSWER: b
19. What line can you add to the /etc/syslog.conf file to log an messages of priority crit from
the Linux kernel to /var/log/kernlog?
a.
b.
c.
d.
kern.crit /var/log/kernlog
kern.=crit /var/log/kernlog
kern.crit -/var/log/kernlog
kern.crit |/var/log/kernlog
6-4
ANSWER: b
20. You have added the following lines to the /etc/logrotate.d/mylog file.
/var/log/mylog {
maxage 44
rotate 5
notifempty
compress
}
Which of the following statements are true about the rotation of the /var/log/mylog file?
(Choose all that apply.)
a. A maximum of 5 archive logs will be kept
b. A maximum of 44 archive logs will be kept
c. The log file will be rotated if the file is empty
d. The log file will be compressed after being rotated
ANSWER: a,d
Discovery Exercises
Viewing Processes using ps
Answers may vary there are many available options to the ps command.
Process Priorities
a. ps -l (a nice value of 0 is shown)
6-5
b. nice n -20 ps -l (a nice value of -20 is shown, which is a high priority only the root
user can run this command)
c. nice n 19 ps -l (a nice value of 19 is shown, which is a low priority any user can
run this command)
Cron Tables
a.
b.
c.
d.
e.
30 1 * * 5 /bin/sample
30 16 15 5 * /bin/sample
0,30 16 1-6 * 0 /bin/sample
*/10 9-17 * * 1 /bin/sample
15 8 * * 1-5 /bin/sample
30 18 * * 1-5 /bin/sample
authpriv.warn /var/log/pamlog
daemon.=notice /var/log/pamlog
kern.* -/var/log/pamlog
cron.warn |/bin/false