LightNovesOnl.com

LPI Linux Certification in a Nutshell Part 18

LPI Linux Certification in a Nutshell - LightNovelsOnl.com

You're reading novel online at LightNovelsOnl.com. Please use the follow button to get notifications about your favorite novels and its latest chapters so you can come back anytime and won't miss anything.

$cp-rfv/etc/skel.

$cp-rfvp/etc/skel.

9. Remove the directory created in the previous exercise, using rmdir rmdir and/or and/or rm rm. Which command can complete the task in a single step?

10. Explain when the wildcard {htm,html} {htm,html} might be useful. might be useful.

11. Give an example of how the wildcard *.[Tt][Xx][Tt] *.[Tt][Xx][Tt] could be used with directory listings. could be used with directory listings.



12. What can be said about filenames matched by the *.? *.? wildcard? wildcard?

13. Experiment with redirecting the output of ls ls as follows: as follows:$cp/etc/skel.2>info.txt 1. How is the terminal output different than that observed in Exercise 8?

2. What is written to info.txt info.txt ? ?

14. Experiment with ps, pstree ps, pstree, and top top to monitor active processes on your system. Include to monitor active processes on your system. Include top top's interactive commands.

15. If you have Apache running, use ps ps (and perhaps (and perhaps grep grep) to identify the httpd httpd process and its PID, which is owned by root. Send that process the process and its PID, which is owned by root. Send that process the HUP HUP signal as follows: signal as follows:$kill-SIGHUPpid Using tail tail, examine the Apache error log (the location of your logfile may differ): $tail/var/log/httpd/error_log What was the effect of HUP HUP on Apache? on Apache?

16. While running X, start some interactive processes in the background and experiment with using jobs jobs, bg bg, and fg fg. For example:$firefox& $xterm& $emacs& $jobs $fg1 $fg2...

Were you able to bring each of the jobs to the foreground successfully?

17. This exercise starts a process, using various methods to view and modify the process execution priority: 18. Start an editing session in the background using nice nice: $nicevi& Observe that the process was nice nice'd using ps ps: $ps-u Check it again using top top: $top-i Within top, renice top, renice the the vi vi process using the process using the r r command and observe the effect on priority. command and observe the effect on priority.

Exit top top and use and use renice renice to set the nice value back to zero. to set the nice value back to zero.

19. Use a simple regular expression with grep grep to find to find bash bash users in users in /etc/pa.s.swd /etc/pa.s.swd.

20. Examine the difference between grep and egrep by issuing the following commands:$grep".+:x:.+:/bin/bash$"/etc/pa.s.swd $egrep".+:x:.+:/bin/bash$"/etc/pa.s.swd How is the output of these commands different? Why?

21. Determine the number of empty lines in /etc/inittab /etc/inittab.

22. Use vi vi to create a text file. Enter to create a text file. Enter insert mode insert mode with with i i and insert text. Quit insert mode with Esc and move around using and insert text. Quit insert mode with Esc and move around using h h, j j, k k, and l l, then re-enter insert mode and add more text. End the session with ZZ. ZZ. cat cat the file. Is it as expected? the file. Is it as expected?

Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 104) Review Questions 1. What are the three types of disk part.i.tions found on a Linux system? Which type can contain other part.i.tions, and which type does it contain?

2. Name the directories that must be within the / / part.i.tion. part.i.tion.

3. Describe the differences between physical disks, part.i.tions, and filesystems.

4. What is a journaling filesystem and how does it differ from a nonjournaling filesystem?

5. What is a swap swap part.i.tion used for? Why not just use swap files? part.i.tion used for? Why not just use swap files?

6. What kind of output will df -h df -h yield? yield?

7. Describe a common situation that is likely to cause the automatic use of fsck fsck on the next system boot. on the next system boot.

8. Name the fields in /etc/fstab /etc/fstab.

9. Give the command to mount a CD-ROM drive on the secondary master IDE device, a.s.suming that /etc/fstab /etc/fstab does not contain a line for the device. does not contain a line for the device.

10. If the ro ro option is used in option is used in /etc/fstab /etc/fstab for for /usr /usr, what limitation is placed on that filesystem?

11. Compare and contrast hard and soft quota limits.

12. Name the symbolic permission that is equivalent to 0754.

13. Describe a situation that requires the SUID permission. What ramifications does this permission imply?

14. How do you determine what binaries on your system have the SUID bit set?

15. Compare and contrast the differences between hard and symbolic links.

16. Name the doc.u.ment to which Linux directory a.s.signments should conform.

17. Compare and contrast the differences between the locate locate and and find find commands. commands.

Exercises 1. As root, run fdisk fdisk on your main hard drive and enter the on your main hard drive and enter the p p command to print the part.i.tion table. Examine your system's configuration and make sure you understand everything you see. Enter the command to print the part.i.tion table. Examine your system's configuration and make sure you understand everything you see. Enter the l l command and review the many part.i.tion types Linux can accommodate. Enter the command and review the many part.i.tion types Linux can accommodate. Enter the q q command to quit without saving changes. command to quit without saving changes.

2. If you have available disk s.p.a.ce, use fdisk fdisk to create a new to create a new ext3 ext3 part.i.tion, and then format it with part.i.tion, and then format it with mkfs mkfs. Pay close attention to the output from mkfs mkfs.

3. Use a pager to examine /var/log/messages /var/log/messages and search for entries made by and search for entries made by fsck fsck. Did it find any problems?

4. If you created a new part.i.tion in the previous exercises, check it with fsck fsck and observe the output: and observe the output:$fsck-f/dev/part.i.tion 5. Check on the status of filesystems using df df:$df-h 1. How does the -h -h flag a.s.sist you with interpreting the results? flag a.s.sist you with interpreting the results?

2. Are any of your filesystems nearly full?

3. Which are underutilized?

6. As root, get a top-level view of disk usage by user using du du:$du-s/home/*

Are there any surprises?

7. How could you use sort sort to make the output from the previous exercise more useful? to make the output from the previous exercise more useful?

8. Review /etc/fstab /etc/fstab. Be sure you can name all six fields and their order as well as describe their function.

9. Examine the output of the mount mount command without options. Compare the output with the contents of command without options. Compare the output with the contents of /etc/fstab /etc/fstab.

10. If you created a new part.i.tion in the previous exercises, mount it on /mnt/new /mnt/new or some other location of your choosing: or some other location of your choosing:$mkdir/mnt/new $mount/dev/part.i.tion/mnt/new $df/mnt/new 1. Did the filesystem mount correctly? Can you store files on it?

Next, unmount it: $umount/dev/part.i.tion/mnt/new Add a line to /etc/fstab /etc/fstab for the new part.i.tion: for the new part.i.tion: /dev/part.i.tion/mnt/newext3defaults12 11. 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?

12. Practice converting these file modes from octal to symbolic form: 1. 0777 2. 0754 3. 0666 4. 1700 5. 7777 13. Practice converting these file modes from symbolic to octal form. You can a.s.sume that x x bits are set under SUID, SGID, and sticky bits: bits are set under SUID, SGID, and sticky bits: 1. -rwxr-xr-x 2. -r--r--r-- 3. -rwsrwsrwx 4. -rw-rw---t 5. -rws-w--w- 14. Create temporary files and use chmod chmod with both symbolic and numeric mode modifications. Include SUID, SGID, and sticky bits. with both symbolic and numeric mode modifications. Include SUID, SGID, and sticky bits.

15. As root root, create temporary files and use chown chown to modify user owners.h.i.+p and group owners.h.i.+p. to modify user owners.h.i.+p and group owners.h.i.+p.

16. Use chgrp chgrp to modify group owners.h.i.+p on the temporary files created in the previous exercise. to modify group owners.h.i.+p on the temporary files created in the previous exercise.

17. Create a temporary file and links as follows:$toucha_file $ln-sa_filean_slink $lna_filean_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-lia_filean_slinkan_hlink 18. Review the latest version of the FHS at http://www.pathname.com/fhs/.

19. Examine your filesystem. Does it match the FHS? If you find discrepancies, is it clear why they don't?

20. Use which which to check on the location of executable files. to check on the location of executable files.

21. Use find find to search for to search for bash bash:$find/-namebash Now use locate locate for the same file: for the same file: $locatebash How are the results different? Describe a context in which each command would be useful.

22. Update your locate locate database using database using updatedb updatedb. Note the amount of time this command takes and the resources it consumes on your system.

Chapter9.Exam 101 Practice Test

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.

Questions 1. What kind of hardware is represented by the device name /dev/hda /dev/hda?

1. Sound Card 2. Modem 3. IDE Hard Drive 4. SCSI Hard Drive 5. SATA Hard Drive 2. What file should you query to determine whether there is an IRQ conflict on your system?

1. /proc/ioports 2. /proc/interrupts 3. /proc/cpuinfo 4. /proc/meminfo 5. /proc/irqstatus 3. Which of the following are arguments you can pa.s.s to the kernel at boot time to tell it to start in runlevel 1 (single-user mode)?

1. one 2. 1 3. safe 4. single 5. user 4. Which process is referred to as the "mother of all processes" and always has PID 1?

1. mother 2. admin 3. administrator 4. init 5. bios 5. Which logfile should you examine for information about the hardware that the kernel initialized at boot time?

1. /var/log/syslog 2. /var/log/messages 3. /var/log/lastlog 4. /var/log/wtmp 5. /var/log/cron 6. 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?

1. The file /boot/grub/grub.conf /boot/grub/grub.conf 2. The file /etc/lilo.conf /etc/lilo.conf 3. An argument pa.s.sed to the kernel at boot time 4. The BIOS 5. The file /etc/inittab /etc/inittab 7. What command line would reboot a running Linux system immediately, forcing an fsck fsck of every drive on reboot? of every drive on reboot?

1. /sbin/shutdown r F now 2. /sbin/shutdown h F now 3. /sbin/shutdown 4. /sbin/shutdown r f now 5. /sbin/shutdown t f 8. Which of the following are valid ways to interactively switch a running system to runlevel 3?

1. chrunlevel 3 2. runlevel 3 3. init 3 4. telinit 3 5. init -3 9. 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?

1. /etc/inittab 2. /etc/rc.d/rc.sysinit 3. A symlink beginning with S S in in /etc/rc.d/rc5.d/ /etc/rc.d/rc5.d/ 4. /etc/rc.d/rc.local 5. A symlink beginning with K K in in /etc/rc.d/rc5.d/ /etc/rc.d/rc5.d/ 10. Which command is used to display the current mounted part.i.tions, their mount points, and the available free s.p.a.ce on each?

1. du 2. df 3. fdisk 4. fsck 5. mount 11. Which part.i.tion is designed to hold data that changes often and is writable by all users?

1. /var 2. /home 3. /tmp 4. /opt 5. /sys 12. What does MBR stand for?

1. Main Booting Runlevel 2. Main Block Record 3. Master Boot Record 4. Master Block Record 5. Master Boot Resource 13. Which of the following lines in /boot/grub/grub.conf /boot/grub/grub.conf would tell GRUB to use the first part.i.tion of the first hard drive as the root part.i.tion? would tell GRUB to use the first part.i.tion of the first hard drive as the root part.i.tion?

1. root (hd0,0) 2. boot (hd0,0) 3. root (hd1,1) 4. boot (hd1,1) 5. root (hd1,0) 14. What file contains a list of directories that are searched to find shared libraries when a binary program is executed?

1. /etc/loader.conf 2. /etc/library/conf 3. /etc/ld.so.cache 4. /etc/ld.so.conf 5. /etc/ld.conf 15. For distributions that use the Debian package management system, what command will download and update all installed packages to the latest available version?

1. apt-get install 2. apt-cache update 3. apt-get update 4. apt-cache install 5. dpkg i 16. If I download a .deb .deb package ( package (package.deb) and wish to install it, what's the best command to use?

1. dpkg i package.deb 2. apt-get install package.deb 3. apt install package.deb 4. dpkg package.deb 5. None of the above 17. For distributions that use the Red Hat package management system, what command will list all packages currently installed?

1. rpm qa 2. rpm i 3. rpm Uvh 4. rpm list 5. rpm all 18. For distributions that use the Red Hat package management system, what command will download and update all installed packages to the latest available version?

1. yum update 2. yum install 3. yum config 4. yum list available 5. yum download 19. What option(s) to rpm rpm will instruct will instruct rpm rpm to run a verification check on all packages installed on the system? to run a verification check on all packages installed on the system?

1. rpm verify all 2. rpm Va 3. rpm qa 4. rpm check 5. rpm c 20. What command is used to display a list of directories the sh.e.l.l will search in to find a command that has been entered?

1. show $MYPATH 2. echo $PATH 3. echo $MYPATH 4. setenv 5. set $PATH 21. Which file(s) does the bash sh.e.l.l read at login to set environment variables?

1. /etc/bashrc 2. ~/.bashrc 3. ~/.bash_profile 4. All of the above 5. None of the above 22. What commands can be used to view a list of the last commands typed into the sh.e.l.l?

1. history 2. 3. 4. All of the above 5. None of the above 23. If my current directory is /opt /opt and I wish to run the command and I wish to run the command /opt/runme /opt/runme, what command(s) could I type (a.s.suming /opt /opt is is not not in your in your $PATH $PATH)?

1. /opt/runme 2. ./runme 3. runme 4. opt/runme 5. ~/runme 24. Which of the following commands will redirect the standard output of /bin/ls /bin/ls to to /dev/null /dev/null, while allowing standard error to display on the screen?

1. /bin/ls > /dev/null 2> /dev/screen 2. /bin/ls 1> /dev/null 3. /bin/ls > /dev/null 4. /bin/ls > /dev/null 2>&1 5. /bin/ls 2> /dev/null 1>&2 25. Which of the following command(s) will display the first 5 lines of the file /etc/pa.s.swd /etc/pa.s.swd?

1. cat -5 /etc/pa.s.swd 2. more -5 /etc/pa.s.swd 3. head -5 /etc/pa.s.swd 4. cat /etc/pa.s.swd head -5 5. cat /etc/pa.s.swd more -5 26. Which commands can be used to perform a search and replace on a file or a text stream?

1. sed 2. tr 3. search 4. cat 5. more 27. What command(s) can be used to copy data to and from raw devices, bypa.s.sing the filesystem?

1. cp 2. tar 3. dd 4. mv 5. sed 28. What option can be pa.s.sed to /bin/ls /bin/ls to display every file in a directory that ends in to display every file in a directory that ends in .txt .txt?

1. ls +.txt 2. ls *.txt 3. ls * txt 4. ls [txt]

5. ls *txt*

29. What option can be pa.s.sed to /bin/ls /bin/ls to display every file that starts with the letters to display every file that starts with the letters a a, b b, or c c?

1. ls abc*

2. ls a*b*c*

3. ls ^abc 4. ls [abc]+ 5. ls [abc]*

Click Like and comment to support us!

RECENTLY UPDATED NOVELS

About LPI Linux Certification in a Nutshell Part 18 novel

You're reading LPI Linux Certification in a Nutshell by Author(s): Adam Haeder. This novel has been translated and updated at LightNovelsOnl.com and has already 962 views. And it would be great if you choose to read and follow your favorite novel on our website. We promise you that we'll bring you the latest novels, a novel list updates everyday and free. LightNovelsOnl.com is a very smart website for reading novels online, friendly on mobile. If you have any questions, please do not hesitate to contact us at [email protected] or just simply leave your comment so we'll know how to make you happy.