LPIC 101-500 & LPIC 102-500
>>Practice Exam #1
Answers with explanation
Take the test here (You need an account. It's free)
Practice Exam 1
1. Which filesystem is used to store information about current running processes?
A. /environment
B. /proc
C. /etc
D. /dev
B. The /proc filesystem stores information about running processes on the system. The /etc filesystem is used for configuration information, and /dev is used for device information. The /environment filesystem does not exist on a default Linux system.
2. What is the default directory for configuration information related to the modprobe command?
A. /etc/modprobe.conf
B. /etc/modprobe
C. /etc/modprobe.d
D. /var/modprobe
C. The /etc/modprobe. d directory contains information related to the modprobe configuration. This can be overridden with the -c option on the command line.
3. Which of the following wall commands send the message "Please Log Off" to users in the operator group?
A. wall -g operator "Please Log Off"
B. wall "Please Log Off"
C. wall -operator "Please Log Off"
D. echo "Please Log Off" | group operator
A. The -g option to wall sends the input to the specified group. Answer B will send the output to all users, whereas answers C and D will not work.
4. Which option to dmesg displays the time in local time?
A. -rel
B. -e
C. -f
D. -t
B. The -e option to dmesg displays the time in a localtime and the delta in a format that is typically easier to work with. The -rel option does not exist. The -f option specifies the logging facility, and -t does not display time at all.
5. Which process ID is typically associated with the init process?
A. 0
B. 1
C. 5
D. 100
B. The init process is typically associated with the initial process ID of 1 to indicate that it is the process from which others are spawned. Killing PID 1 will typically and immediately halt the system.
6. You have been troubleshooting a system issue that may be related to the driver in use for a PCI device in the system. Which command and option will display the PCI devices and the drivers being used for those devices?
A. lsusb -v
B. ls -pci
C. lspci -k
D. showpci
C. The lspci command shows the PCI devices in the system, and the - k option shows the kernel driver being used by the given device. The lsusb command will not accomplish the task requested and the ls command with -pci will not display the correct information. There is no showpci command.
7. Which option to the telinit command will cause the operation to not send any notice to logged-on users?
A. -q
B. -v
C. -no-wall
D. -l
C. The -no-wall option will cause telinit to not send a wall command to logged-in users about the state change. The other options listed in this question do not exist.
8. Which file in the sysfs filesystem could you view in order to see the MAC address of eth0?
A. /sys/class/net/eth0/address
B. /sys/devices/eth0
C. /sysfs/devices/eth0
D. /sys/net/eth0
A. The class/net hierarchy within /sys contains information on the network configuration for the computer. It is a symlink to the devices hierarchy, where the device will be listed by its address rather than the logical eth0 name.
9. When using systemctl to kill a process, what is the default signal sent to a process?
A. SIGKILL
B. SIGTERM
C. SIGINT
D. SIGCALL
B. The SIGTERM signal is the default signal sent with the systemctl kill command.
10. A newly added Serial ATA (SATA) disk is not showing up during the boot process. Where can you check to begin troubleshooting this issue?
A. Using system logging
B. Using debugf s
C. Within the fdisk utility
D. Within the computer BIOS
D. A logical location to begin troubleshooting is within the system BIOS to ensure that the drive is being detected by the computer.
11. Which command can be used to monitor communication taking place with dbus?
A. dbus-mon
B. dbus -m
C. dbus-monitor
D. dbus-debug
11. C. The dbus-monitor program, which requires an X display, can be used to monitor dbus. The other programs and options listed for this question do not exist.
12. Within a systemd environment, which service manages udev?
A. systemd-udevd.service
B. systemd-udev.service
C. udevd-service
D. systemd.udevd-service
A. The udevd service is called systemd-udevd.service within a systemd environment.
13. What is the correct syntax to indicate that the system should shut down at 8 p.m.?
A. shutdown 20:00
B. shutdown 8pm
C. shutdown +20:00
D. halt 20
A. The system can be scheduled to shut down at a certain time, and that time should be entered in 24-hour format, as shown in the answer.
14. Which option to the systemctl kill command will change the signal sent to the process to be killed?
A. -k
B. -f
C. -s
D. -d
C. The - s option changes the signal to be sent from its default of SIGTERM. The new signal must be one of the main signal types, such as SIGINT or SIGSTOP.
15. Which systemd command and option is equivalent to the chkconfig -list command in a SysVinit environment?
A. systemctl list-unit-files
B. systemctl list-service
C. systemctl -list
D. systemctl list-unit-files -type=service
D. The list-unit-files command will show the files available, whereas -type=service will limit those files to the services, in the same way that chkconfig-list returns a list of services.
16. Which option to ldconfig is used to change the location of the cache to be updated?
A. -c
B. -c
C. -f
D. -v
A. The -c option sets the location of the cache to be updated instead of the default /etc/ld.so.cache. The lowercase option, -c, changes the format of the cache, whereas -v sets verbose mode. The -f option does not exist.
17. Which of the following commands will remove all files for a package in Debian, including configuration files?
A. apt-get remove
B. apt-cache clean
C. dpkg -P
D. apt-get conf-remove
C. The -P option to dpkg will purge a package from the system, including the configuration files associated with the package. The apt-cache clean command cleans the package cache but not an individual package, and the apt -get remove command removes a package but not the associated configuration files.
18. What is the prefix used to denote a Debian source repository in /etc/apt/sources.list?
A. deb
B. source
C. deb-src
D. debsrc
C. The deb-src prefix is used to indicate that a given repository contains source packages. The deb prefix in option A would indicate normal packages. The other options are not valid.
19. Which options to rpm will upgrade a package while displaying progress and other additional information about the operation?
A. -Iv
B. -Uvh
C. -U
D. -vh
B. The -u option is used to upgrade a package. Adding -v for verbose and - h for hash marks will print additional information and progress, as requested by the problem.
20. Which option to a yum install command will cause yum to assume yes and therefore not prompt for verification when performing actions deemed critical?
A. -y
B. -f
C. -p
D. -m
A. The -y or -assumeyes option will do what it says: Assume that you will answer “yes” and therefore not prompt. The other options do not exist.
21. When working with a yum-based system, you need to create a configuration to ensure that certain packages are not upgraded or installed. Which option can you set in /etc/yum.conf to facilitate this behavior?
A. exclude
B. noupdate
C. assumeupdate
D. clearupdate
A. The exclude option within /etc/yum.conf is a space-separated list of packages that accepts wildcards and is a list of packages that cannot be installed or upgraded. The other options listed in this question do not exist.
22. You are having difficulty with shared libraries on the system. Which of the following commands will print the current directories and libraries in the cache?
A. ldconfig -C
B. ldd -f
C. ldconfig -p
D. ldd -b
C. The ldconfig command is used to work with the library cache, and the -p option prints the directories and libraries in the cache. The -c option tells ldconfig to use a different cache. The ldd command prints the library dependencies for a given command, but the options given don’t exist for ldd.
23. Which option within a .repo file in /etc/yum.repos.d/ is used to set the URL for the repository?
A. url
B. repourl
C. httpurl
D. baseurl
D. The baseurl option is used to set the URL and must be fully qualified, meaning that it must include the protocol, such as http:// or file://.
24. Which command and option is used to display basic information about each available package and its dependencies on a Debian system?
A. apt-get list
B. apt-cache dump
C. apt-get list-all
D. apt-cache list
B. The apt-cache dump command will display a listing of the available packages and their respective dependencies. The other commands and options listed in this question do not exist.
25. When running the lsblk command, there is no separate partition listed for /boot. From which partition is the system likely booted?
A. There is a /boot directory under the / partition.
B. The /boot partition is hidden.
C. The system has not yet built the /boot partition.
D. The /boot partition does not show up with lsblk.
A. The /boot directory almost certainly exists but has not been partitioned into its own space. The /boot partition would not be hidden from lsbik if it was indeed a separate partition.
26. Within which hierarchy is cached data stored for both yum- and apt-style Systems?
A. /etc
B. /var/cache
C. /usr/lib
D. /tmp
B. The /var/cache hierarchy contains cached data for both package management tools—in the case of yum, in /var/cache/yum, and in the case of a Debian-based system, in /var/cache/apt.
27. On a BlOS-based system, within which region of the disk is the boot loader typically installed?
A. MBR
B. /boot
C. Sector 8192
D. Front
A. The master boot record (MBR) is the typical location for the boot loader to be stored on a BlOS-based system.
28. Which of the following best describes the contents of the / filesystem within Linux?
A. The / filesystem is the root filesystem and contains temporary files.
B. The / filesystem is root’s home directory.
C. The / filesystem is used for storage of device and swap information.
D. The / filesystem is the root filesystem and is the logical root of the hierarchy within Linux.
D. The / filesystem is the root filesystem. If separate partitions have not been created, the / filesystem will be the beginning of the hierarchy and will contain all other directories in the same partition.
29. Which of the following commands will send the output of the grub-mkconfig command to the correct location for booting?
A. grub-mkconfig -output=/boot/grub2/grub.cfg
B. grub-mkconfig -file=/boot/grub2.menu
C. grub-mkconfig -file=/boot/grub.lst
D. grub-mkconfig -output=/boot/menu.lst
A. The -output option configures the location for output of the command instead of STDOUT.
30. Which of the following commands writes an image called from the current directory called debian.img to the SD card mounted at /dev/sdc?
A. dd if=debian.img of=/dev/sdc bs=1M
B. imgwrite debian.img > /dev/sdc
C. imgw debian.img | cat /dev/sdc
D. dd debian.img > /dev/sdc
A. The dd command is used for this purpose, and for this case it takes an input file with the if option and an output destination with the of option. The bs option signals that the block size for writing should be 1 megabyte.
31. When troubleshooting a problem, you look through .bash_history to determine commands that you’ve recently executed. However, the file does not contain information from your current session. Which command can you use to view the commands that have been executed during the current session?
A. cmdhist
B. cmds
C. pwd
D. history
D. The history command displays history from the current session and can be used for the purpose described. The .bash_history file is written on session close, by default.
32. Which option should be sent to grub-install if you want to install the boot images within a directory other than /boot?
A. -boot
B. -image
C. -boot-directory
D. -b
C. The -boot-directory option will install the boot images into the directory specified. This might be helpful for nonstandard installs or at times when you need to mount the boot partition separately. The other options listed in this question do not exist.
33. Which command should be run in order to make changes take effect for a GRUB2 configuration change?
A. update-grub
B. grub-update
C. grub-config
D. grub-ins
A. The update-grub command should be executed in order to make changes take effect in the menu and when changes have been made to the GRUB configuration. The other commands listed in this question do not exist.
34. Which of the following commands will set the environment variable JAVA_PATH equal to /home/user/java2 when using the Bash shell?
A. invoke JAVA_PATH=/home/user/java2
B. export JAVA_PATH=/home/user/java2
C. envvar JAVA_PATH=/home/user/java2
D. echo JAVA_PATH=/home/user/java2
B. The export command is used for this purpose and accepts a name=value pair, as shown in the answer. The other commands are not valid with the exception of the echo command, which will simply echo the argument to the console.
35. Which option in the .bashrc sets the number of commands to keep in the .bash_history file?
A. HISTLIMIT
B. HISTORYFILE
C. HISTFILESIZE
D. HISTNUM
C. The HISTFILESIZE option configures the number of commands to keep in the history file. The other variables are not valid within Bash.
36. Which of the following commands will cause nl to number all lines, including blank lines, for a file called test.php?
A. nl test.php
B. nl -a test.php
C. nl -n test.php
D. nl -b a test.php
D. The - b option configures the body numbering format for nl, which by default will not number blank lines. The a format option will number all lines, including blanks. The -a option is not valid for the nl command, and the -n option configures the numbering format and would require an additional argument in order to be valid.
37. Which command can be used to create an octal representation of a given plaintext file?
A. oct
B. cat
C. list
D. od
D. The od command is used to create octal output. The cat command will show the file as it exists on disk. The other two commands are not valid.
38. Which command and option can be used to format text with pagination in a double-space format, including page numbers?
A. pr -d
B. pag -db
C. cat -pd
D. print -d
A. The pr command formats text for printing, including the date and page numbers at the top of each page. Adding the -d option causes the output to be double-spaced. The cat command will display output but not paginated in such a way. The other two commands are not valid.
39. Of the following options for the tail command, which option outputs the last lines beginning at the 30th line from the start of the file rather than the end of the file?
A. -n +30
B. -n 30
C. -30
D. +30
A. The -n option is used to change the number of lines. Adding the +N after the -n option begins the tail process at the Nth line within the file.
40. Which option to the uniq command causes the matching to be done in a case-insensitive manner?
A. -c
B. -f
C. -i
D. -n
C. The -i option causes the unique test to be done while ignoring the case of the element to be matched.
41. Which of the following commands prints the username and real name of all users in /etc/passwd in a tab-separated format?
A. cut -d: -f 1,6 /etc/passwd
B. sed 's/://' /etc/passwd
C. awk -F: '{print $1,$5}' OFS="\t" /etc/passwd
D. cat -o "\t" /etc/passwd
C. The awk command shown can be used for this purpose. The -F option sets the field separator, and the OFS option sets the output field separator.
42. Which option to cp will preserve symlinks in a recursive copy?
A. -f
B. -d
C. -a
D. -b
C. The -a option is equivalent to the -d and -R options, which preserve links and copy recursively, respectively. The -b option creates a backup, and -f forces the copy.
43. Which of the following key combinations is a technique for moving to the 23rd line of a file in Vi?
A. 23G
B. /23
C. i23
D. zz
A. When in command mode, typing a number followed by an uppercase G will immediately move the cursor to that line number. The /23 option will search for the number 23 in the file. The i23 option will insert the number 23, and finally zz will exit Vi.
44. Which option to the top command changes the update interval?
A. -d
B. -t
C. -n
D. -f
A. The -d option changes the update interval and can be helpful on a busy system where top may be affecting performance. The - n option sets the number of iterations to run. There is no -t or -f option for top.
45. Which of the following commands will display the process ID, the real user ID, the filesystem access user ID, and command for processes on the system?
A. listproc -uf
B. ps -eo pid,euser,fuser,comm
C. ps -e pid,user,comm
D. ps -fa
B. The ps -e command is used to display all processes, and the - o option configures the columns to display.
46. Which command can be used to search the contents of all files below your current location for files that contain the characters DB?
A. grep -r "DB" *
B. grep -ri "DB" *
C. cat * | less
D. cat *.txt | grep DB
A. The grep command will be used for this purpose. Note the difference between grep -r and grep -ri. The question did not ask for case insensitivity, and therefore the use of -i in option B makes it incorrect.
47. Which of the following commands will locate all files that begin with the name DB, starting from the current directory?
A. locate "DB*"
B. find ./ -name "DB*"
C. whereis "DB*"
D. find "DB*"
B. The find command will be used for this purpose. Setting the directory from which to begin the find is required, along with the expression, which in this case, are files beginning with DB.
48. Which of the following files is the location used to gather information about load average for use in the uptime command?
A. /proc/uptime
B. /proc/loadavg
C. /proc/load
D. /proc/utime
B. Load average information is gathered from /proc/loadavg, whereas uptime information is stored on /proc/uptime.
49. When running fsck on an EXT3 filesystem, which option to fsck causes the operation to prompt when attempting a repair action?
A. -y
B. -f
C. -a
D. No option required
D. Interactive repair is the default, so no option is required. The -f option forces the operation, and -y and -a are both variations of non-interactive repair.
50. Which of the following files is updated dynamically with information about currently mounted filesystems?
A. /etc/fstab
B. /etc/files
C. /boot/fstab
D. /etc/mtab
D. The /etc/mtab file is updated dynamically as filesystems are mounted and unmounted. The /etc/fstab file is not dynamically updated.
51. When running the df command, you need to change the scale so that the report shows terabytes instead of bytes. Which option will accomplish this task?
A. -ST
B. -BT
C. -j
D. -T
B. The -B option changes the format, and T sets the scale to terabytes. The -T option alone prints the filesystem type. The other options do not exist.
52. What command can be used to create an image of important metadata for an ext3 filesystem?
A. e2image
B. e3image
C. dumpe2fs
D. dumpe3fs
A. The e2image program can be used to create an image of metadata that can help with drive recovery. The resulting image file can be used with programs like dumpe2fs and debugfs.
53. Which option to mke2fs is used to check for bad blocks during filesystem creation?
A. -a
B. -b
C. -c
D. -d
C. The -c option checks for bad blocks. The -b option sets the block size. There is no -a or -d option.
54. Which of the following commands changes the ownership of the file called Functions.php to the user john and the group coders?
A. chgrp john:coders Functions.php
B. chown john:coders Functions.php
C. chown coders.john Functions.php
D. chown Functions.php john:coders
B. The chown command is used for this purpose and can be used to set both the user and group for ownership.
55. When bootstrapping a virtual machine, which command can be used to add the fingerprint of a server to the known_hosts file?
A. ssh-keyscan
B. ssh-keyadd
C. ssh-keylist
D. ssh-getkey
A. The ssh-keyscan command can be used for the purpose described and can help with virtual machine deployment by obtaining the SSH host key and adding it to the known_hosts file.
56. Which configuration option can be set within /etc/default/grub to affect the behavior of the system after a failed boot?
A. GRUB_RECOVER
B. GRUB_NOFAIL
C. GRUB_RECORDFAIL_TIMEOUT
D. GRUB_RECOVER_TIMEOUT
C. The GRUB_RECORDFAIL_TIMEOUT option is used to configure the behavior of the system in the event of a failed boot. Setting the value to -1 will display the GRUB menu and not continue booting. Setting the value to 0 will cause the menu to not display. Setting to a value greater than or equal to 1 will cause the menu to display for that many seconds.
57. Which options to du will print a summary of information in a human-readable format?
A. -sh
B. -h
C. -s
D. -su
A. The -s option displays a summary, and -h displays it in a human-readable format.
58. Which option to the find command causes it to follow symbolic links?
A. -s
B. -H
C. -P
D. -L
D. The -L option tells find to follow symlinks. The -H and -P options are both variations to tell find not to follow symlinks, and the -s option does not exist.
59. Which option to the tee command enables appending to the destination files rather than overwriting?
A. -a
B. -m
C. -g
D. -d
A. The -a option appends to the file rather than overwriting when using tee. The other options do not fulfill the needs of the problem statement.
60. When creating a backup for a system, which directory should be included so that most configuration files will be backed up?
A. /var
B. /opt
C. /etc
D. /bin
C. The /etc directory and its subdirectories typically contain configuration files that would be necessary in order to re-create the system in a restoration scenario. The /var directory usually contains variable information, whereas /opt may be used for several other purposes. The /bin directory contains binaries that can usually be reinstalled.
