30. Which file extensions are common for files or directories that have been concatenated with tar tar and then compressed with and then compressed with bzip2 bzip2?

1. .tar.bz2 2. .tbz2 3. .tbz 4. All of the above 5. None of the above 31. What device should you redirect output to if you do not want to see it or save it?

1. /dev/zero 2. /dev/nothing 3. /dev/empty 4. /dev/null 5. /dev/bitbucket 32. Which of the following commands would list the contents of the directory /tmp /tmp, store that list in the file /root/tmp.txt /root/tmp.txt, and display the list a screen at a time?

1. ls l /tmptee /root/tmp.txtmore 2. ls l /tmpxargs /root/tmp.txtmore 3. ls l /tmpmoretee /root/tmp.txt 4. tee /root/tmp.txtls l /tmpmore 5. more /tmptee /root/tmp.txt 33. What character is used after a command line to indicate that the command should run in the background and return sh.e.l.l control to the user?

1. *



2. + 3. & 4.

5. .

34. 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?

1. hangup 2. detach 3. nohup 4. background 5. bg 35. What command will display a full-screen, updated list of all running processes?

1. kill 2. ps 3. list 4. top 5. free 36. If a running process is not responding to a standard terminate signal from the /bin/kill /bin/kill command, what option can you pa.s.s to force the process to terminate immediately? command, what option can you pa.s.s to force the process to terminate immediately?

1. kill -1 2. kill --HUP 3. kill --stop 4. kill -9 5. kill --now 37. 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 38. Which command line would start the program /usr/bin/top /usr/bin/top with the highest priority possible? 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 39. Which command is used to modify the priority of a process already running?

1. nice 2. renice 3. priority 4. chage 5. ps 40. Which command(s) would display every line in /tmp/file.txt /tmp/file.txt that begins with the letter that begins with the letter h h and ends with the letter and ends with the letter t 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 41. Which command(s) would display every line in /tmp/file.txt /tmp/file.txt that contains at least one letter of the alphabet? 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 42. In the vi vi editor, what command sequence given in command mode will make a copy of the current line? 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 43. In the vi vi editor, what command sequence given in command mode will save the current file and quit the editor? 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 44. In the vi vi editor, what command sequence given in command mode will quit a file without saving, even if changes have been made? 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!

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

1. ext2 2. ext3 3. xfs 4. reiserfs 5. vfat 46. What command will create an ext3 part.i.tion on the first part.i.tion 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 47. What command is used to convert an existing ext2 part.i.tion (/dev/sda1) to an ext3 (journaled) part.i.tion?

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 48. What command is used to display the number of free inodes on an ext2 or ext3 part.i.tion?

1. tune2fs 2. dumpe2fs 3. showe2fs 4. fsck 5. fdisk 49. Which file defines what part.i.tions are mounted at boot time?

1. /etc/part.i.tions 2. /etc/mount 3. /etc/mtab 4. /etc/fstab 5. /etc/filesystems 50. Which command will mount all part.i.tions of type nfs defined in /etc/fstab /etc/fstab?

1. mount a t nfs 2. mount a nfs t 3. mount nfs 4. mountall nfs 5. None of the above 51. 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 /etc/fstab?

1. mountable 2. noroot 3. user 4. ok 5. mount 52. Which option to chmod chmod would a.s.sign read/write permission to the file owner, read-only permission to the group owner, and read-only permission to everyone else? would a.s.sign 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 53. Which option to umask 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? 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 54. Which command can be used to quickly tell you if an executable command is in any directory defined in your $PATH $PATH environment variable? environment variable?

1. find 2. locate 3. which 4. who 5. what 55. 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 56. According to the Filesystem Hierarchy Standard, what directory (or directories) must hold the system kernel?

1. /boot 2. / 3. /opt 4. /sbin 5. /kernel 57. What command is used to maintain the filesystem index that the command /usr/bin/locate /usr/bin/locate searches? searches?

1. update 2. updatelocate 3. locate update 4. updatedb 5. update -db

Answers 1. c. IDE Hard Drive IDE Hard Drive 2. b. /proc/interrupts /proc/interrupts 3. b. 1 1 AND AND d. d. single single. Both answers are correct.

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

6. d. The BIOS The BIOS 7. a. /sbin/shutdown r F now /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 F (force (force fsck fsck on reboot) and on reboot) and f f (skip (skip fsck fsck on reboot). on reboot).

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

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

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

12. c. Master Boot Record Master Boot Record 13. a. root (hd0,0) root (hd0,0). GRUB (the Grand Unified Boot Loader) starts counting drives and part.i.tions at 0, so the first part.i.tion on the first drive is 0,0.

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

15. c. apt-get update apt-get update 16. a. dpkg i package.deb dpkg i package.deb 17. a. rpm qa rpm qa 18. a. yum update yum update 19. a. rpm verify all rpm verify all AND AND b. b. rpm Va rpm Va. Both of these commands are equivalent.

20. b. echo $PATH echo $PATH 21. d. All of the above. Remember that the ~ key indicates a user"s home directory. All of the above. Remember that the ~ key indicates a user"s home directory.

22. d. All of the above. The All of the above. The history 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. 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 /opt/runme AND AND b. b. ./runme ./runme 24. b. /bin/ls 1> /dev/null /bin/ls 1> /dev/null AND AND c. c. /bin/ls > /dev/null /bin/ls > /dev/null. The syntax > > and and 1> 1> are equivalent. If you don"t redirect are equivalent. If you don"t redirect STDERR STDERR, it will display to the screen by default.

25. c. head -5 /etc/pa.s.swd head -5 /etc/pa.s.swd AND AND d. d. cat /etc/pa.s.swdhead -5 cat /etc/pa.s.swdhead -5 26. a. sed sed AND AND b. b. tr tr 27. b. tar tar AND AND c. c. dd dd. The tar tar command is often used to talk directly to tape devices ( command is often used to talk directly to tape devices (tar xvf /dev/st0), and dd dd can be used to make copies of devices. For example, to create a raw image of a 1.44 MB floppy disk, use 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 dd if=/dev/fd0 of=/tmp/floppy.img 28. c. ls *.txt 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 ls [abc]* [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, 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 tar.bz2, tbz2 tbz2, and .tbz .tbz are all examples of file extensions you might see to indicate that a file is tarred and bzipped. are all examples of file extensions you might see to indicate that a file is tarred and bzipped.

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

32. a. ls ls l /tmptee /root/tmp.txtmore l /tmptee /root/tmp.txtmore. It"s important to remember the order of commands when you are piping multiple commands together, especially when the tee tee command is involved. command is involved.

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

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

36. d. kill -9 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 killall 38. a. nice --20 /usr/bin/top 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 pa.s.s the highest priority to a process, I have to pa.s.s -20 -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 pa.s.sing a negative number to 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 pa.s.sing a negative number to the nice nice command. command.

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

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

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

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

44. c. :q! :q!. The vi 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 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 vi.

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

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

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

48. b. dumpe2fs dumpe2fs 49. d. /etc/fstab /etc/fstab 50. a. mount a t nfs mount a t nfs 51. c. user user 52. a. chmod 644 file.txt chmod 644 file.txt 53. b. umask 022 umask 022 54. c. which which 55. a. /sbin /sbin 56. a. /boot /boot AND AND b. b. / /. Both directories are correct. Most Linux distributions will store the kernel in /boot /boot; the presence of a kernel in / / is deprecated. is deprecated.

57. d. updatedb updatedb

Chapter10.Exam 101 Highlighter"s Index

System Architecture Objective 101.1: Determine and Configure Hardware Settings PC BIOS The BIOS is the PC"s firmware.

The BIOS sets date and time for on-board clock, storage device configuration, and so on, via menus.

Resource a.s.signments Interrupts (IRQs) allow peripherals to interrupt the CPU.

I/O addresses are locations in the processor"s memory map for hardware devices.

Useful files to query for hardware information: /proc/interrupts /proc/interrupts, /proc/ioports /proc/ioports, /proc/cpuinfo /proc/cpuinfo, /proc/devices /proc/devices.

Useful commands to run for hardware information: /sbin/lspci /sbin/lspci, /sbin/lsusb /sbin/lsusb.

DMA allows certain devices to work directly with memory, freeing the processor (see Table10-1 Table10-1).

Table10-1.Common device settings

Device I/O address IRQ DMA ttyS0 (COM1) 3f8 4 NA ttyS1 (COM2) 2f8 3 NA ttyS2 (COM3) 3e8 4 NA ttyS3 (COM4) 2e8 3 NA lp0 (LPT1) 378-37f 7 3 (if configured in the BIOS) lp1 (LPT2) 278-27f 5 NA fd0, fd1 (floppies 1 and 2) 3f0-3f7 6 2

Objective 101.2: Boot the System Boot order Power on BIOS Boot Loader Kernel init startup services sh.e.l.l Information The command dmesg dmesg can be used to view the output of the boot process. can be used to view the output of the boot process.

The init init process is always PID 1 and is the parent of all other processes. process is always PID 1 and is the parent of all other processes.

Objective 101.3: Change Runlevels and Shut Down or Reboot System Runlevels Defaults are defined in Table10-2 Table10-2.

Table10-2.Default Runlevels

Runlevel Description 0 Halt 1 Single-user mode 2 Multiuser, without NFS 3 Full multiuser mode, without X 4 Unused 5 Full multiuser mode, with X 6 Reboot

Runlevels can be changed on-the-fly with init init or or telinit telinit .

The default runlevel is stored in the file /etc/inittab /etc/inittab.

The init init process will run the scripts in process will run the scripts in /etc/rc.d/rcX.d /etc/rc.d/rcX.d (where X is your default runlevel) in order, sending a "stop" parameter to scripts that start with K and a "start" parameter to scripts that start with S. (where X is your default runlevel) in order, sending a "stop" parameter to scripts that start with K and a "start" parameter to scripts that start with S.

Linux Installation and Package Management Objective 102.1: Design Hard Disk Layout Keep / / small by distributing larger parts of the directory tree to other filesystems. small by distributing larger parts of the directory tree to other filesystems.

Separate a small /boot /boot part.i.tion below cylinder 1024 for kernels. part.i.tion below cylinder 1024 for kernels.

Separate /var /var into its own part.i.tion to prevent runaway logs from filling into its own part.i.tion to prevent runaway logs from filling / /.

Separate /tmp /tmp.

Separate /usr /usr if it is to be shared read-only among other systems via NFS. if it is to be shared read-only among other systems via NFS.

© 2024 www.topnovel.cc