Which of the following commands prints all files and directories within the /tmp directory or its subdirectories which are also owned by the user root? (Choose TWO correct answers.)
find /tmp -uid root -print
find -path /tmp -uid root
find /tmp -user root -print
find /tmp -user root
find -path /tmp -user root –print
The find command is used to search for files and directories that match certain criteria. The -uid option specifies the numeric user ID of the owner of the file or directory, while the -user option specifies the name of the owner. The -print option prints the full file name of the matching file or directory to the standard output. Therefore, both find /tmp -uid root -print and find /tmp -user root -print will print all files and directories within the /tmp directory or its subdirectories which are also owned by the user root. The other options are either invalid or do not perform the desired task. The -path option matches the whole path name, not just the starting directory. The -print option is implied if no other action is specified, but it is good practice to include it for clarity. References:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.4 Use streams, pipes and redirects
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
: 6
The /etc/_______ file lists currently mounted devices.
mtab
The /etc/mtab file is a system-generated file that lists all the currently mounted devices and their mount options. It is updated automatically by the mount and umount commands. It can be used to check which devices are mounted and where, as well as their filesystem type and mount options. The /etc/mtab file has the same format as the /etc/fstab file, which is a user-edited file that lists the devices that should be mounted at boot time or on demand. References:
LPIC-1 Exam 101 Objectives, Topic 101: System Architecture, 101.1 Determine and configure hardware settings, Key Knowledge Areas, The following is a partial list of the used files, terms and utilities: /etc/mtab
LPIC-1 101-500 Exam Prep, Section 1: System Architecture, Lesson 1.1: Determine and Configure Hardware Settings, Video: 1.1.4 Mounting and Unmounting Filesystems, Transcript: The /etc/mtab file is a system-generated file that lists all the currently mounted devices and their mount options.
You are trying to make a hard link to an ordinary file but ln returns an error. Which of the following could cause this?
The source file is hidden.
The source file is read-only.
The source file is a shell script.
You do not own the source file.
The source and the target are on different filesystems.
A hard link is a directory entry that refers to the same inode as another file. An inode is a data structure that stores the metadata and the location of the data blocks of a file. A hard link allows multiple names to refer to the same file content, as long as they are on the same filesystem. However, if the source and the target of the hard link are on different filesystems, the ln command will return an error, because the inode numbers are not consistent across different filesystems. Therefore, the ln command cannot create a hard link that crosses filesystem boundaries. The other options are either incorrect or not applicable. The source file being hidden, read-only, a shell script, or not owned by the user does not prevent the creation of a hard link, as long as the user has the permission to write to the target directory and the source and the target are on the same filesystem. References:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.3 Perform basic file management
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
Immediately after deleting 3 lines of text in vi and moving the cursor to a different line, which single character command will insert the deleted content below the current line?
i (lowercase)
P (uppercase)
p (lowercase)
U (uppercase)
u (lowercase)
The p command in vi inserts the content of the buffer below the current line. The buffer is where the deleted or yanked text is stored temporarily. The P command inserts the buffer above the current line. The i command enters the insert mode before the cursor position. The U command restores the current line to its original state. The u command undoes the last change made to the file. References:
[LPI Linux Essentials - 1.3 Basic Editing]
[LPI Linux Essentials - 1.4 I/O Redirection]
[LPI Linux Essentials - 1.5 Manage Simple Partitions and Filesystems]
Which of the following commands kills the process with the PID 123 but allows the process to "clean up" before exiting?
kill -PIPE 123
kill -KILL 123
kill -STOP 123
kill -TERM 123
The command kill -TERM 123 kills the process with the PID 123 but allows the process to “clean up” before exiting. The option -TERM specifies the signal to be sent to the process, which is the termination signal (SIGTERM). This signal requests the process to terminate gracefully, which means that the process can perform any necessary actions before exiting, such as closing files, releasing resources, or saving data. The process can also catch the signal and ignore it or handle it in a different way, if it is programmed to do so. The syntax is: kill -TERM pid. For example, kill -TERM 123 will send the SIGTERM signal to the process with the PID 123, asking it to terminate nicely. The other options are not correct because:
A. kill -PIPE 123: This command sends the broken pipe signal (SIGPIPE) to the process, which is not used to kill the process, but to notify it that the other end of a pipe has been closed. This signal is usually ignored by the process, unless it is writing to the pipe, in which case it will cause the process to terminate1.
B. kill -KILL 123: This command sends the kill signal (SIGKILL) to the process, which is the most powerful way to kill the process, but it does not allow the process to “clean up” before exiting. The SIGKILL signal cannot be caught, blocked, or ignored by the process, and it forces the process to terminate immediately, without performing any actions. This command should be used as a last resort, when the process is unresponsive or causing harm to the system2.
C. kill -STOP 123: This command sends the stop signal (SIGSTOP) to the process, which is not used to kill the process, but to pause it. The SIGSTOP signal cannot be caught, blocked, or ignored by the process, and it suspends the execution of the process until it receives a continue signal (SIGCONT). This command can be used to temporarily stop a process from running, without terminating it3. References:
What is the purpose of the SIGPIPE signal? - Stack Overflow
How to kill a process in Linux - LinuxConfig.org
Linux Signals - GeeksforGeeks
When running the command
sed -e "s/a/b/" /tmp/file >/tmp/file
While /tmp/file contains data, why is /tmp/file empty afterwards?
The file order is incorrect. The destination file must be mentioned before the command to ensure redirection.
The command sed did not match anything in that file therefore the output is empty.
When the shell establishes the redirection it overwrites the target file before the redirected command starts and opens it for reading.
Redirection for shell commands do not work using the > character. It only works using the | character instead.
The problem with the command
sed -e “s/a/b/” /tmp/file >/tmp/file
is that it tries to read and write from the same file, which results in overwriting the file before the command can process it. The shell sets up the redirection by opening the file /tmp/file for writing and truncating it to zero length. Then it executes the sed command, which tries to read from the same file, but finds it empty. Therefore, the output is also empty and the file remains empty. A possible solution is to use a temporary file for the output and then rename it to the original file name. For example:
sed -e “s/a/b/” /tmp/file >/tmp/file.tmp && mv /tmp/file.tmp /tmp/file
This way, the original file is not overwritten until the sed command finishes successfully. The other options are either incorrect or not applicable. The file order is correct, the sed command does match something in the file, and the > character is valid for redirection. The | character is used for piping, not redirection. References:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.4 Use streams, pipes and redirects
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
Which of the following commands will send output from the program myapp to both standard output (stdout) and the file file1.log?
cat < myapp | cat > file1.log
myapp 0>&1 | cat > file1.log
myapp | cat > file1.log
myapp | tee file1.log
tee myapp file1.log
The tee command reads from standard input and writes to both standard output and one or more files1. Therefore, the command myapp | tee file1.log will send the output of the program myapp to both the terminal and the file file1.log. The other commands will either fail to write to both standard output and file, or write the wrong output. For example, the command cat < myapp | cat > file1.log will try to read the file myapp as input and write it to the file file1.log, but it will not display anything on the terminal. The command myapp 0>&1 | cat > file1.log will redirect the standard input of myapp to its standard output, and then pipe it to the file file1.log, but it will not display anything on the terminal. The command myapp | cat > file1.log will pipe the output of myapp to the file file1.log, but it will not display anything on the terminal. The command tee myapp file1.log will try to read from standard input and write to both the file myapp and the file file1.log, but it will not execute the program myapp. References:
[LPI Linux Essentials - 1.3 Basic Editing]
[LPI Linux Essentials - 1.4 I/O Redirection]
[LPI Linux Essentials - 1.5 Manage Simple Partitions and Filesystems]
What is the default nice level when a process is started using the nice command?
-10
10
20
0
The default nice level when a process is started using the nice command is 10. This means that the process will have a lower priority than the normal processes, which have a nice level of 0. The nice command allows the user to adjust the priority of a process at the time of its execution. The syntax of the nice command is:
nice [-n {nice value increment}] [command]
The -n option specifies the nice value increment, which can be a positive or negative integer in the range of -20 to 19. The command is the name of the program or script to be executed. If the -n option is omitted, the default nice value increment is 10. For example, the following command will run the program ackermann with a nice value of 10:
nice ./ackermann
To verify the nice value of a running process, we can use the ps or top commands and look at the NI column. For example, the following command will show the nice value of the ackermann process:
ps -el | grep ackermann
In compliance with the FHS, in which of the directories are man pages found?
/usr/share/man
/opt/man
/usr/doc/
/var/pkg/man
/var/man
According to the Filesystem Hierarchy Standard (FHS), the directory /usr/share/man contains manual pages for user commands, system calls, library functions, and other documentation1. The other directories are either non-standard, deprecated, or used for different purposes. For example, /opt/man is used for manual pages for add-on application software packages1, /usr/doc/ is an old location for documentation files that is no longer used2, /var/pkg/man and /var/man are not defined by the FHS. References:
[LPI Linux Essentials - 1.6 Basic File Editing]
[LPI Linux Essentials - 1.7 Personalize and/or Localize Your Linux System]
[LPI Linux Essentials - 1.8 Basic Security and File Permissions]
What is the effect of the egrep command when the -v option is used?
It enables color to highlight matching parts.
It only outputs non-matching lines.
It shows the command's version information.
It changes the output order showing the last matching line first.
The -v option for the egrep command activates the invert matching mode, which means that it only outputs the lines that do not match the given pattern or regular expression. This is useful for filtering out unwanted lines or finding exceptions in a file. For example, the following command will output all the lines in the file my_text that do not contain the word “Linux”:
egrep -v Linux my_text
The -v option can be combined with other options to modify the output format or behavior of the egrep command. For example, the -c option will count the number of non-matching lines instead of printing them, and the -i option will ignore the case of the pattern while matching. References:
[LPI Exam 101 Detailed Objectives], Topic 103: GNU and Unix Commands, Objective 103.7: Perform basic file management, Weight: 4, Key Knowledge Areas: Use of egrep to search for extended regular expressions in text output.
[Linux egrep Command with Examples], Topic: Invert Matching with egrep.
Which of the following commands will print the last 10 lines of a text file to the standard output?
cat -n 10 filename
dump -n 10 filename
head -n 10 filename
tail -n 10 filename
The tail command prints the last part of a file to the standard output. The -n option specifies the number of lines to print. Therefore, tail -n 10 filename will print the last 10 lines of the file named filename. The other commands are either invalid or do not perform the desired task. The cat command concatenates files and prints them to the standard output, but it does not have a -n option. The dump command is used to backup filesystems, not to print files. The head command prints the first part of a file, not the last part. References:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.3 Perform basic file management
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
Which of the following signals is sent to a process when the key combination CTRL+C is pressed on the keyboard?
SIGTERM
SIGINT
SIGSTOP
SIGKILL
The SIGINT signal is sent to a process when the user presses the key combination CTRL+C on the keyboard. This signal is used to interrupt the process and cause it to terminate, unless the process catches or ignores the signal. The SIGTERM signal is the default signal sent by the kill command to request a process to terminate gracefully. The SIGSTOP signal is used to pause a process and make it stop executing until it receives a SIGCONT signal. The SIGKILL signal is used to force a process to terminate immediately and cannot be caught or ignored by the process. References:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.2 Process management
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
Which of the following characters can be combined with a separator string in order to read from the current input source until the separator string, which is on a separate line and without any trailing spaces, is reached?
<<
<|
!<
&<
The << character is used to create a here document, which is a special type of redirection that reads input from the current source until a line containing only the delimiter (with no trailing blanks) is seen. The delimiter is specified after the << operator, and can be any string. For example, the following command will print everything between the << EOF and EOF lines:
cat << EOF This is a here document It can span multiple lines EOF
The output is:
This is a here document It can span multiple lines
The < character is used for normal input redirection, which reads data from a file or another command. The <| and !< characters are not valid redirection operators in Linux. The &< character is used to duplicate input file descriptors, which is an advanced topic not covered by the Linux Essentials exam. References:
[LPI Exam 101 Detailed Objectives], Topic 103: GNU and Unix Commands, Objective 103.4: Use streams, pipes and redirects, Weight: 4, Key Knowledge Areas: Redirecting standard input, standard output and standard error.
[LPI Linux Essentials Certification All-in-One Exam Guide], Chapter 5: Working with Files, Page 167, Using Here Documents.
QUESTIONNO: 16
Which of the following commands will NOT update the modify timestamp on the file /tmp/myfile.txt?
A. file /tmp/myfile.txt
B. echo "Hello" >/tmp/myfile.txt
C. sed -ie "s/1/2/" /tmp/myfile.txt
D. echo -n "Hello" >>/tmp/myfile.txt
E. touch/tmp/myfile.txt
Answer: A
The file command will not update the modify timestamp on the file /tmp/myfile.txt because it only reads the file content and determines its type. It does not write or change anything in the file.
The other commands will update the modify timestamp on the file /tmp/myfile.txt because they either overwrite the file content (B and C), append to the file content (D), or explicitly change the file timestamp (E).
Regarding the command:
nice -5 /usr/bin/prog
Which of the following statements is correct?
/usr/bin/prog is executed with a nice level of -5.
/usr/bin/prog is executed with a nice level of 5.
/usr/bin/prog is executed with a priority of -5.
/usr/bin/prog is executed with a priority of 5.
The nice command is used to start a process with a modified scheduling priority. The scheduling priority is a value that determines how much CPU time a process will receive from the kernel. The lower the priority, the more CPU time a process will get. The priority is also known as the nice value, because a process with a high nice value is being nice to other processes by giving up CPU time. The nice value ranges from -20 to 19, with -20 being the highest priority and 19 being the lowest. By default, processes are started with a nice value of 0, which means normal priority.
The nice command takes an optional argument -n followed by a number, which specifies the increment or decrement of the nice value from the default value of 0. For example, the command:
nice -n 5 /usr/bin/prog
will start the /usr/bin/prog process with a nice value of 5, which means a lower priority than the default. Similarly, the command:
nice -n -5 /usr/bin/prog
will start the /usr/bin/prog process with a nice value of -5, which means a higher priority than the default. If the -n argument is omitted, the nice command will assume a default increment of 10. For example, the command:
nice /usr/bin/prog
will start the /usr/bin/prog process with a nice value of 10, which means a very low priority. Note that only the root user can start a process with a negative nice value, as this requires special privileges.
Therefore, the command:
nice -5 /usr/bin/prog
is equivalent to:
nice -n -5 /usr/bin/prog
and will start the /usr/bin/prog process with a nice value of -5, which means a higher priority than the default. This means that the correct answer is B. /usr/bin/prog is executed with a nice level of 5.
Which shell command is used to continue background execution of a suspended command?
&
bg
cont
exec
:&
The bg command is used to resume a suspended command in the background, allowing it to run without user interaction. The command takes a job ID as an argument, which can be obtained by using the jobs command. Alternatively, if no job ID is specified, bg will resume the most recently suspended job. The bg command is part of the job control features of the Linux shell, which allow users to manage multiple processes running in the same terminal. References:
LPI Linux Essentials: 1.3.2 Job Control
LPI Linux Administrator: 103.1 Work on the command line
When given the following command line.
echo "foo bar" | tee bar | cat
Which of the following output is created?
cat
foo bar
tee bar
bar
foo
The output of the given command line is foo bar. The command line consists of three commands that are connected by pipes (|). A pipe is a symbol that redirects the standard output of one command to the standard input of another command. The echo command prints its argument to the standard output, which is foo bar in this case. The tee command reads from the standard input and writes to both the standard output and a file. The file name is given as an argument, which is bar in this case. The cat command reads from the standard input and writes to the standard output. Therefore, the command line does the following:
The echo command prints foo bar to the standard output, which is redirected to the standard input of the tee command by the first pipe.
The tee command reads foo bar from the standard input and writes it to both the standard output and the file bar. The standard output of the tee command is redirected to the standard input of the cat command by the second pipe.
The cat command reads foo bar from the standard input and writes it to the standard output, which is displayed on the terminal.
Hence, the output of the command line is foo bar. The other options are either incorrect or not applicable. The cat, tee bar and bar are not printed by any of the commands. The foo is only part of the output, not the whole output. References:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.4 Use streams, pipes and redirects
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
What is the output of the following command?
echo "Hello World" | tr -d aieou
Hello World
eoo
Hll Wrld
eoo Hll Wrld
The tr command is used to translate or delete characters from a given input. The -d option specifies that the characters in the second argument should be deleted from the input. In this case, the second argument is aieou, which are the vowels in the English alphabet. Therefore, the tr command will delete any vowel from the input, which is Hello World. The output will be the input without any vowels, which is Hll Wrld. References:
[LPI Exam 101 Detailed Objectives], Topic 103: GNU and Unix Commands, Objective 103.7: Perform basic file management, Weight: 4, Key Knowledge Areas: Use of tr to perform basic text transformations.
[LPI Linux Essentials Certification All-in-One Exam Guide], Chapter 5: Working with Files, Page 165, Using the tr Command.
What is the difference between the i and a command of the vi editor?
i (interactive) requires the user to explicitly switch between vi modes whereas a (automatic) switches modes automatically.
i (insert) inserts text before the current cursor position whereas a (append) inserts text after the cursor.
i (independent rows) starts every new line at the first character whereas a (aligned rows) keeps the indentation of the previous line.
i (interrupt) temporarily suspends editing of a file to the background whereas a (abort) terminates editing.
The i and a commands are two of the most commonly used commands in the vi editor to enter the insert mode. The insert mode allows the user to insert text into the file. The difference between the i and a commands is that the i command inserts text before the current cursor position, while the a command inserts text after the cursor position. For example, if the cursor is on the letter “e” in the word “editor”, then pressing i will allow the user to insert text before the “e”, while pressing a will allow the user to insert text after the “e”. The user can exit the insert mode by pressing the Esc key, which will return to the command mode. References:
Basic vi commands (cheat sheet)
VI Editor with Commands in Linux/Unix Tutorial
How to use Vi editor in Linux (with examples)
Which of the following are init systems used within Linux systems? (Choose THREE correct answers.)
startd
systemd
Upstart
SysInit
SysV init
systemd, Upstart, and SysV init are all init systems used within Linux systems. An init system is the first process executed by the kernel at boot time, which has a process ID (PID) of 1, and is responsible for starting and managing all other processes on the system. Different init systems have different features, advantages, and disadvantages. Some of the most common init systems are:
systemd: A relatively new and modern init system that aims to provide a unified and efficient way of managing system and service states. It is compatible with SysV and LSB init scripts, and supports features such as parallel processing, socket activation, logging, job scheduling, and more. It is the default init system for many popular Linux distributions, such as Fedora, Debian, Ubuntu, Arch Linux, and others12.
Upstart: An event-based init system developed by Ubuntu as a replacement for SysV init. It starts and stops system tasks and processes based on events, such as hardware changes, network availability, filesystem mounting, etc. It is a hybrid init system that uses both SysV and systemd scripts, and supports features such as parallel processing, dependency tracking, logging, and more. It is the default init system for some older versions of Ubuntu, and some other Linux distributions, such as Linux Mint and Chrome OS12.
SysV init: A mature and traditional init system that follows the System V (SysV) design of Unix operating systems. It uses a series of runlevels to define the state of the system, and executes scripts in the /etc/rc.d or /etc/init.d directories according to the current runlevel. It is simple and stable, but lacks some features of modern init systems, such as parallel processing, event handling, dependency tracking, etc. It is still used by some Linux distributions, such as Slackware, Gentoo, and others12.
Which SysV init configuration file should be modified to disable the ctrl-alt-delete key combination?
/etc/keys
/proc/keys
/etc/inittab
/proc/inittab
/etc/reboot
The /etc/inittab file is used by the SysV init system to configure the behavior of different runlevels and the actions to be taken when certain events occur. One of the events that can be configured is the ctrl-alt-delete key combination, which by default triggers a system reboot. To disable this feature, the /etc/inittab file should be modified to comment out or remove the line that starts with ca::ctrlaltdel:. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.1
The system is having trouble and the engineer wants to bypass the usual /sbin/init start up and run /bin/sh. What is the usual way to pass this change to the kernel from your boot loader?
Start in runlevel 1.
Pass init=/bin/sh on the kernel parameter line.
Pass /bin/sh on the kernel parameter line.
Pass start=/bin/sh on the kernel parameter line.
The usual way to pass this change to the kernel from the boot loader is to pass init=/bin/sh on the kernel parameter line12. The init kernel parameter is used to specify the program that is run as the first process after the kernel is loaded3. By default, this program is /sbin/init, which is responsible for starting and managing other processes and services4. However, by passing init=/bin/sh, the kernel will run /bin/sh instead, which is a shell program that allows the user to execute commands interactively or from a script5. This way, the user can bypass the usual initialization process and run /bin/sh as the root user, which can be useful for troubleshooting or recovery purposes12.
The other options in the question are not correct because:
A. Start in runlevel 1: This option would not bypass the /sbin/init program, but rather instruct it to start the system in single-user mode, which is a mode that allows only the root user to log in, and disables all network services and graphical interfaces. To start in runlevel 1, the user would need to pass single or 1 on the kernel parameter line, not init=/bin/sh.
C. Pass /bin/sh on the kernel parameter line: This option would not work, because the kernel would not recognize /bin/sh as a valid parameter and would ignore it. The kernel only accepts parameters that have a specific format, such as name=value or name.flag3. To specify the init program, the user would need to use the init= prefix, as in init=/bin/sh3.
D. Pass start=/bin/sh on the kernel parameter line: This option would also not work, because the kernel does not have a start parameter. The user would need to use the init parameter, as in init=/bin/sh3.
Which of the following commands will write a message to the terminals of all logged in users?
bcast
mesg
wall
yell
The wall command is a command-line utility that displays messages to all logged-in users on the terminal12. The wall command takes the following basic syntax:
$ wall OPTION { file | message }
The OPTION can be one of the following:
-n or --nobanner: Suppress the banner (the header line with the hostname, date, and time) from the output. This option can only be used by the root user.
-v or --version: Display version information and exit.
-h or --help: Display help message and exit.
The file or message argument is the source of the message to be displayed. If a file is specified, the wall command will read the message from the file. If a message is specified, the wall command will read the message from the standard input. The message can be terminated by pressing Ctrl+D.
The other commands in the options are not valid or do not have the same functionality as the wall command:
bcast: There is no such command in Linux.
mesg: This command is used to control write access to the terminal. It does not send messages to other users.
print: This command is used to print files or data to a printer. It does not send messages to other users.
yell: There is no such command in Linux.
You suspect that a new ethernet card might be conflicting with another device. Which file should you check within the /proc tree to learn which IRQs are being used by which kernel drivers?
proc/interrupts
The file that you should check within the /proc tree to learn which IRQs are being used by which kernel drivers is /proc/interrupts1 Comprehensive Explanation: The /proc/interrupts file is a virtual file that provides information about the number and type of interrupts per CPU per I/O device12. It displays the IRQ number, the number of that interrupt handled by each CPU core, the interrupt type, and a comma-delimited list of drivers that are registered to receive that interrupt12. For example, the following output shows the contents of /proc/interrupts on a system with two CPUs and several devices:
The first column shows the IRQ number, followed by one column for each CPU core showing the number of interrupts handled by that core. The last column shows the interrupt type and the driver name. Some interrupt types are:
IO-APIC-edge: An edge-triggered interrupt from the I/O Advanced Programmable Interrupt Controller (APIC), which is a hardware device that handles and distributes interrupts.
IO-APIC-fasteoi: A fast end-of-interrupt from the I/O APIC, which means that the interrupt is acknowledged early to allow nesting interrupts.
PCI-MSI-edge: A Message Signaled Interrupt (MSI) from the Peripheral Component Interconnect (PCI) bus, which is a hardware bus that connects devices to the system. MSI is a method of sending interrupts using special messages instead of dedicated lines.
NMI: A Non-Maskable Interrupt, which is a hardware interrupt that cannot be ignored by the CPU and usually indicates a critical error.
LOC: A Local timer interrupt, which is a periodic interrupt generated by a local APIC on each CPU core for scheduling purposes.
RES: A Rescheduling interrupt, which is a type of inter-processor interrupt (IPI) that is sent to a CPU core to force it to reschedule its current task.
To check if a new ethernet card might be conflicting with another device, you can look for the driver name of the ethernet card in the /proc/interrupts file and see if it shares the same IRQ number with another device. If so, you can try to change the IRQ assignment of the devices or use the smp_affinity file to control which CPU cores can handle the interrupt12.
Which run levels should never be declared as the default run level when using SysV init? (Choose TWO correct answers.)
0
1
3
5
6
Run levels are predefined modes of operation in the SysV init system that determine which processes and services are started or stopped. The default run level is the one that the system enters after booting. It is usually specified in the /etc/inittab file with a line like id:5:initdefault:. The run levels 0 and 6 should never be declared as the default run level because they are used to halt and reboot the system, respectively. If they are set as the default, the system will enter an endless loop of shutting down and restarting. The other run levels (1-5) have different meanings depending on the distribution, but they usually correspond to single-user mode, multi-user mode, network mode, graphical mode, etc. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.3
Which file in the /proc filesystem lists parameters passed from the bootloader to the kernel? (Specify the file name only without any path.)
cmdline
The file in the /proc filesystem that lists the parameters passed from the bootloader to the kernel is /proc/cmdline. This file contains a single line of text that shows the command line arguments that were used to boot the kernel. These arguments can include various options, such as the root device, the init process, the console device, and more. The /proc/cmdline file is read-only and cannot be modified at runtime. The parameters in this file are determined by the bootloader configuration, such as GRUB or LILO, and can be changed by editing the corresponding files12.
Which of the following information is stored within the BIOS? (Choose TWO correct answers.)
Boot device order
Linux kernel version
Timezone
Hardware configuration
The system's hostname
The BIOS (Basic Input/Output System) is a firmware that is stored in a ROM chip on the motherboard and is responsible for initializing the hardware and loading the bootloader. The BIOS has a setup utility that allows the user to configure various settings, such as the boot device order, the hardware configuration, the system date and time, the security options, etc. The BIOS does not store information about the Linux kernel version, the time zone, or the system’s hostname, as these are part of the operating system and are not relevant for the BIOS. References: LPI Linux Essentials - 1.101.1, LPI Linux Administrator - 102.1
Which of the following kernel parameters instructs the kernel to suppress most boot messages?
silent
verbose=0
nomesg
quiet
The quiet kernel parameter instructs the kernel to suppress most boot messages, except for critical errors12. The quiet parameter can be added to the GRUB_CMDLINE_LINUX_DEFAULT variable in the /etc/default/grub file and then run sudo update-grub to apply the changes3. The quiet parameter can also be used in combination with other parameters, such as splash, to enable a graphical boot screen4.
The other options in the question are not valid or do not have the same functionality as the quiet parameter:
silent: There is no such kernel parameter in Linux.
verbose=0: This parameter is used to set the verbosity level of the kernel messages, but it does not suppress them completely. The valid values for this parameter are from 0 (quiet) to 7 (debug)5.
nomesg: This parameter is used to disable all kernel messages on the console, including the emergency ones. This parameter is not recommended for normal use, as it can hide critical errors and prevent troubleshooting.
During a system boot cycle, what program is executed after the BIOS completes its tasks?
The bootloader
The inetd program
The init program
The kernel
The bootloader is a program that is executed by the BIOS after it completes its tasks of initializing the hardware and performing the POST (Power-On Self Test). The bootloader is responsible for loading the kernel and other necessary files into memory and passing control to the kernel. The bootloader can be either installed in the Master Boot Record (MBR) of the disk or in a separate partition. Some examples of bootloaders are GRUB, LILO, and SYSLINUX. References: LPI Linux Essentials - 1.101.1, LPI Linux Administrator - 102.1
What information can the lspci command display about the system hardware? (Choose THREE correct answers.)
Device IRQ settings
PCI bus speed
System battery type
Device vendor identification
Ethernet MAC address
The lspci command can display information about the system hardware, such as:
Device IRQ settings1: The lspci command can show the interrupt request (IRQ) number assigned to each device by using the -v option. The IRQ number indicates how the device communicates with the CPU.
PCI bus speed2: The lspci command can show the speed of the PCI bus by using the -vv option. The speed is expressed in megahertz (MHz) or gigahertz (GHz) and indicates how fast the data can be transferred between the device and the bus.
Device vendor identification3: The lspci command can show the name and identification number of the device vendor by using the -n or -nn option. The vendor identification helps to identify the manufacturer and model of the device.
You are having some trouble with a disk partition and you need to do maintenance on this partition but your users home directories are on it and several are logged in. Which command would disconnect the users and allow you to safely execute maintenance tasks?
telinit 1
shutdown -r now
killall -9 inetd
/bin/netstop --maint
/etc/rc.d/init.d/network stop
The command that would disconnect the users and allow you to safely execute maintenance tasks on a disk partition is telinit 112. The telinit command is used to change the runlevel of the system, which is a mode of operation that defines what processes and services are running3. The runlevel 1, also known as single-user mode, is a mode that allows only the root user to log in, and disables all network services and graphical interfaces4. This mode is useful for performing system maintenance and recovery tasks, such as repairing a disk partition5.
The other options in the question are not correct because:
B. shutdown -r now: This command would reboot the system immediately, without disconnecting the users gracefully or allowing you to do any maintenance tasks.
C. killall -9 inetd: This command would kill the inetd process, which is a daemon that manages network services. This would not disconnect the users who are already logged in, and it would not stop other processes that might interfere with the maintenance tasks.
D. /bin/netstop --maint: There is no such command in Linux.
E. /etc/rc.d/init.d/network stop: This command would stop the network service, which would disconnect the users who are logged in remotely, but not the ones who are logged in locally. It would also not stop other processes that might interfere with the maintenance tasks.
Which of the following statements is correct when talking about /proc/?
All changes to files in /proc/ are stored in /etc/proc.d/ and restored on reboot.
All files within /proc/ are read-only and their contents cannot be changed.
All changes to files in /proc/ are immediately recognized by the kernel.
All files within /proc/ are only readable by the root user.
The /proc/ directory is a virtual filesystem that provides a view of the kernel’s data structures and parameters. It contains information about processes, hardware, memory, modules, and other aspects of the system. The files in /proc/ are not stored on disk, but are generated on the fly by the kernel when they are accessed. Therefore, any changes to files in /proc/ are immediately recognized by the kernel and affect its behavior. For example, writing a value to /proc/sys/kernel/hostname will change the system’s hostname without rebooting. The files in /proc/ are not all read-only; some of them can be modified by the root user or by processes with the appropriate permissions. The files in /proc/ are readable by any user, unless restricted by the kernel or by the mount options. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 102.3
Which of the following options for the kernel's command line changes the systemd boot target to rescue.target instead of the default target?
systemd.target=rescue.target
systemd.runlevel=rescue.target
systemd.service=rescue.target
systemd.default=rescue.target
systemd.unit=rescue.target
Which of the following commands brings a system running SysV init into a state in which it is safe to perform maintenance tasks? (Choose TWO correct answers.)
shutdown -R 1 now
shutdown -single now
init 1
telinit 1
runlevel 1
The commands init 1 and telinit 1 both bring a system running SysV init into a state in which it is safe to perform maintenance tasks. This state is also known as single-user mode or runlevel 1, where only the root user can log in and no network services are running. The command shutdown -R 1 now is incorrect, because it reboots the system instead of entering single-user mode. The command shutdown -single now is invalid, because the -single option does not exist for the shutdown command. The command runlevel 1 is also invalid, because runlevel is a command that displays the current and previous runlevels, not a command that changes the runlevel. References:
1: SysVinit - ArchWiki
2: Linux: How to write a System V init script to start, stop, and restart my own application or service - nixCraft
3: sysvinit - Gentoo wiki
Which command displays the contents of the Kernel Ring Buffer on the command line? (Provide only the command name without any options or path information)
dmesg,
The command that displays the contents of the Kernel Ring Buffer on the command line is dmesg12. The dmesg command is a Linux utility that displays kernel-related messages retrieved from the kernel ring buffer12. The ring buffer stores information about hardware, device driver initialization, and messages from kernel modules that take place during system startup12. The dmesg command is invaluable when troubleshooting hardware-related errors, warnings, and for diagnosing device failure2.
The dmesg command can be used with various options to control the output format, filter the messages by facility or level, clear the ring buffer, or follow the new messages in real time123. For example, the following command displays the last 10 messages from the kernel ring buffer:
$ dmesg | tail -10
The following command displays the messages from the kernel ring buffer in a human-readable format with colored output:
$ dmesg -H --color
The following command displays the messages from the kernel ring buffer that have the facility kern and the level emerg:
$ dmesg -f kern -l emerg
The following command clears the ring buffer:
$ dmesg --clear
The following command keeps dmesg running and waiting for new messages:
$ dmesg -w
Which of the following commands reboots the system when using SysV init? (Choose TWO correct answers.)
shutdown -r now
shutdown -r "rebooting"
telinit 6
telinit 0
shutdown -k now "rebooting"
The shutdown command is used to bring the system down in a safe and controlled way. It can take various options and arguments, such as the time of shutdown, the message to broadcast to users, the halt or reboot mode, etc. The option -r instructs the shutdown command to reboot the system after shutting down. The argument now means to shut down immediately. Therefore, shutdown -r now will reboot the system without delay. The telinit command is used to change the run level of the system. It takes a single argument that specifies the new run level. The run level 6 is reserved for rebooting the system. Therefore, telinit 6 will also reboot the system. The other options are either incorrect or irrelevant. shutdown -r “rebooting” will also reboot the system, but with a delay of one minute and a message to the users. telinit 0 will halt the system, not reboot it. shutdown -k now “rebooting” will only send a warning message to the users, but not actually shut down or reboot the system. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.3
What is the first program that is usually started, at boot time, by the Linux kernel when using SysV init?
/lib/init.so
/sbin/init
/etc/rc.d/rcinit
/proc/sys/kernel/init
/boot/init
The first program that is usually started, at boot time, by the Linux kernel when using SysV init is /sbin/init. This program is responsible for reading the /etc/inittab file and executing the appropriate scripts and programs for each runlevel. The other options are not valid programs that are started by the kernel. /lib/init.so is a shared library that is used by some init programs, but not by SysV init. /etc/rc.d/rcinit is a script that is run by init, not by the kernel. /proc/sys/kernel/init is a kernel parameter that can be used to specify a different init program, but the default value is /sbin/init. /boot/init is not a standard location for an init program, and it is unlikely that the kernel would find it there. References:
1: SysVinit - ArchWiki
2: Linux: How to write a System V init script to start, stop, and restart my own application or service - nixCraft
3: sysvinit - Gentoo wiki
Which of the following commands updates the already installed RPM package rpmname?
rpm --update rpmname
rpm –U rpmname
rpm –q rpmname
rpm --force rpmname
rpm –u rpmname
The rpm command is used to install, upgrade, query, verify and remove RPM packages on Linux systems. The -U option is used to upgrade an existing package to a newer version, or install a package if it does not exist in the RPM database. The -U option is equivalent to -e (erase) followed by -i (install). The other options are not valid for upgrading a package. The -q option is for querying a package, the -e option is for erasing a package, the --force option is for overriding conflicts, and the -u option is not a valid option for the rpm command. References: Using RPM Command to Install, Upgrade and Remove Packages, Linux package management with YUM and RPM
Which of the following shell commands makes the already defined variable TEST visible to new child processes? (Choose two.)
visible TEST
declare +x TEST
declare –x TEST
export TEST
export –v TEST
The export command makes a shell variable available to child processes of the current shell. It can also be used to list all the exported variables. The -v option makes the export command print the variable name and value for each exported variable. The declare command can be used to set or display the attributes and values of shell variables. The -x option makes a variable exported to subsequent commands. The +x option removes the export attribute from a variable. The visible command is not a valid shell command. References:
LPI 101-500 Exam Objectives, Topic 103.1, Weight 4
LPI Learning Materials, Chapter 3.1, Shell Variables and Environment
Web Search Results, 1
What is the process ID number of the init process on a SysV init based system?
-1
0
1
It is different with each reboot.
It is set to the current run level.
The process ID number of the init process on a SysV init based system is 1. The init process is the first process that runs on the system, and it is responsible for initializing the user-space environment and spawning all other processes. The init process is always the first process that runs on the system, and it has the process ID (PID) of 1. The PID is a unique identifier for each process on the system, and it is assigned by the kernel. The PID of the init process is always 1, regardless of the reboot or the run level. You can verify the PID of the init process by using the ps command, which shows information about the processes on the system. For example, to show the PID, the user, the command, and the arguments of the init process, use the following command:
ps -p 1 -o pid,user,cmd
The output of the command will show something like:
PID USER CMD 1 root /sbin/init
This shows that the init process has the PID of 1, the user of root, and the command of /sbin/init.
In the vi editor, what vi command will copy (but not paste) from the current line at the cursor and the following 16 lines (17 lines total)? Specify the correct vi command without spaces.
17yy
The vi editor is a text editor that operates in two modes: command mode and insert mode. In command mode, the user can enter commands to perform various operations on the text, such as copying, pasting, deleting, moving, searching, etc. In insert mode, the user can type text into the file. To switch from command mode to insert mode, the user can press i, a, o, or other keys. To switch from insert mode to command mode, the user can press Esc. The yy command is used to copy (yank) the current line into a buffer. The number before the yy command specifies how many lines to copy, starting from the current line. Therefore, the command 17yy will copy the current line and the following 16 lines (17 lines total) into a buffer. The buffer can then be pasted into another location by using the p or P command. Note that the command 17yy does not paste the copied lines, it only copies them. References:
LPI 101-500 Exam Objectives, Topic 103.8, Weight 4
LPI Learning Materials, Chapter 3.8, Advanced Scripting
Web Search Results, 1
What is the purpose of the xargs command?
It passes arguments to an X server.
It reads standard input (STDIN) and builds up command lines to execute.
It helps shell scripts take variable argument lists.
It asks a question, graphically, and returns the answer to the shell.
It allows users to specify long options for commands that normally only accept short options.
The purpose of the xargs command is to read standard input (STDIN) and build up command lines to execute. The xargs command can be used to pass arguments to another command that does not accept input from a pipe. For example, rm | xargs echo will echo the arguments passed to the rm command. The xargs command can also limit the number of arguments per command line, insert arguments at different positions, and handle special characters in the input. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.3: Perform basic file management, xargs command
The system configuration file named _______ is commonly used to set the default runlevel. (Please provide the file name with full path information)
/etc/inittab
The system configuration file named /etc/inittab is commonly used to set the default runlevel. This file contains information about the initialization process of the system, and it defines the default runlevel, the available runlevels, and the actions to be taken when entering or leaving a runlevel. The default runlevel is the mode of operation that the system starts up into, and it determines which services and processes are running. The default runlevel is specified by a line similar to the following in the /etc/inittab file:
id:5:initdefault:
The number after the first colon indicates the default runlevel, which can range from 0 to 6. The meaning of each runlevel is:
0 — Halt
1 — Single-user text mode
2 — Not used (user-definable)
3 — Full multi-user text mode
4 — Not used (user-definable)
5 — Full multi-user graphical mode (with an X-based login screen)
6 — Reboot
To change the default runlevel, edit the /etc/inittab file as root and change the number to the desired runlevel. For example, to change the default runlevel to 3, use the following command:
sudo nano /etc/inittab
And change the line to:
id:3:initdefault:
Then save and exit the file. The changes will take effect on the next reboot.
Which of the following command lines creates or, in case it already exists, overwrites a file called data with the output of ls?
ls 3> data
ls >& data
ls > data
ls >> data
The command line that will create or, in case it already exists, overwrite a file called data with the output of ls is ls > data. The > character is a redirection operator that redirects the standard output (STDOUT) of a command to a file. If the file does not exist, it will be created. If the file already exists, it will be overwritten. The 3> character is not a valid redirection operator. The >& character is a redirection operator that redirects both standard output (STDOUT) and standard error (STDERR) of a command to a file. The >> character is a redirection operator that appends the standard output (STDOUT) of a command to a file, without overwriting the existing file contents. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.3: Perform basic file management, Redirection
Which type of filesystem is created by mkfs when it is executed with the block device name only and without any additional parameters?
ext2
ext3
ext4
XFS
VFAT
The mkfs command creates a file system on a given device partition. If the type of file system is not specified, the default file system type is ext2. This is mentioned in the man page of mkfs1 and also in the article by How-To Geek2. Ext2 is an older file system that does not support journaling, which is a feature that allows the file system to recover from crashes or power failures. Ext2 is not very commonly used nowadays, as most Linux systems prefer ext4 or other file systems that support journaling and other features. References:
How to Use the mkfs Command on Linux - How-To Geek
mkfs(8): build file system - Linux man page
Which command reads and displays the current contents of the Kernel Ring Buffer on the command line? (Specify ONLY the command without any path or parameters.)
dmesg
The dmesg command is used to print or control the kernel ring buffer. The kernel ring buffer is a special kind of buffer that stores the messages generated by the kernel, such as the boot messages, the hardware errors, the driver information, etc. The kernel ring buffer is a fixed-size circular buffer, which means that when it is full, the oldest messages are overwritten by the new ones. The dmesg command can show the messages in the kernel ring buffer, as well as filter, save, or clear them. The syntax of the dmesg command is:
dmesg [options]
The options are optional, and they can modify the behavior of the dmesg command, such as changing the output format, the timestamp, the level, the facility, the color, etc. For more information, see the dmesg man page1 or the Linuxize tutorial2.
Which of the following commands is used to modify quota settings? (Choose two.)
editquota
setquota
edquota
quotaedit
quotaset
The following commands are used to modify quota settings:
B. setquota: This command is used to set disk quotas for users or groups on a filesystem. The setquota command requires the user or group name, the soft and hard limits for blocks and inodes, and the device name or mount point of the filesystem as arguments. For example, to set a quota for user sammy with a 100MB soft limit and a 110MB hard limit for blocks, and a 1000 soft limit and a 1100 hard limit for inodes on the /home filesystem, use the following command:
sudo setquota -u sammy 100M 110M 1000 1100 /home
C. edquota: This command is used to edit disk quotas for users or groups on a filesystem. The edquota command opens an editor, such as nano or vi, with the current quota settings for the specified user or group. You can then modify the settings as you wish, and save and exit the editor to apply the changes. For example, to edit the quota for user sammy on the /home filesystem, use the following command:
sudo edquota -u sammy
This will open an editor with the following content:
Disk quotas for user sammy (uid 1000): Filesystem blocks soft hard inodes soft hard /dev/vda1 40 0 0 13 0 0 /dev/vda2 1024 102400 112640 10 1000 1100
You can then change the values as you wish, and save and exit the editor to apply the changes.
The other options are not valid commands or options. The editquota and quotaedit commands do not exist on a standard Linux system. The quotaset command is a synonym for setquota, but it is not commonly used.
Which of the following commands creates an ext3 filesystem on /dev/sdb1? (Choose TWO correct answers.)
/sbin/mke2fs -j /dev/sdb1
/sbin/mkfs -t ext3 /dev/sdb1
/sbin/mkfs -c ext3 /dev/sdb1
/sbin/mke3fs -j /dev/sdb1
The correct commands to create an ext3 filesystem on /dev/sdb1 are /sbin/mke2fs -j /dev/sdb1 and /sbin/mkfs -t ext3 /dev/sdb1. These commands format the partition /dev/sdb1 with the ext3 filesystem type. The first command uses the mke2fs utility with the -j option, which enables journaling. The second command uses the mkfs utility with the -t option, which specifies the filesystem type. Both commands are equivalent and can be used interchangeably. The other options are incorrect because they use the wrong syntax or parameters for the commands. Option C is wrong because the -c option for the mkfs command checks the device for bad blocks, not the filesystem type. Option D is wrong because there is no such utility as mke3fs. The correct utility name is mke2fs.
Which chown command will change the ownership to dave and the group to staff on a file named data.txt?
chown dave/staff data.txt
chown –u dave –g staff data.txt
chown --user dave --group staff data.txt
chown dave:staff data.txt
The chown command is used to change the owner and group of files and directories in Linux. The basic syntax of the chown command is:
chown [options] user[:group] file…
The user is the name or the numeric ID of the new owner of the file. The group is the name or the numeric ID of the new group of the file. The file is the name or the path of the file or directory to be changed. The user and group are separated by a colon (:), not a slash (/). The group is optional, and if it is omitted, the group will not be changed. The options are optional, and they can modify the behavior of the chown command, such as changing the ownership recursively, silently, or verbosely.
In this question, the user is dave and the group is staff. The file is data.txt. Therefore, the correct command to change the ownership to dave and the group to staff on data.txt is:
chown dave:staff data.txt
This command will change the owner of data.txt to dave and the group of data.txt to staff. You can verify the changes by using the ls -l command to view the owner and group of data.txt.
The other options are not correct because:
A. chown dave/staff data.txt: This command is not valid because it uses a slash (/) instead of a colon (:) to separate the user and group. The slash (/) is used to separate the directories in a path, not the user and group in the chown command. If you run this command, you will get an error message saying:
chown: invalid user: ‘dave/staff’
B. chown -u dave -g staff data.txt: This command is not valid because it uses the -u and -g options, which do not exist in the chown command. The -u and -g options are used in the chgrp command, which is used to change only the group of files and directories, not the owner. The chown command does not have the -u and -g options, and it uses the user[:group] argument to specify the new owner and group. If you run this command, you will get an error message saying:
chown: invalid option – ‘u’ Try ‘chown --help’ for more information.
C. chown --user dave --group staff data.txt: This command is not valid because it uses the --user and --group options, which do not exist in the chown command. The --user and --group options are used in the usermod command, which is used to modify the user account information, not the file ownership. The chown command does not have the --user and --group options, and it uses the user[:group] argument to specify the new owner and group. If you run this command, you will get an error message saying:
chown: unrecognized option ‘–user’ Try ‘chown --help’ for more information.
Which of the following commands shows the definition of a given shell command?
where
stat
type
case
The type command shows the type of a given shell command, which can be one of the following: alias, keyword, function, builtin, or file. For example, type ls will show that ls is an alias for ls --color=auto. The type command can also show the full path of a file command, such as type grep will show that grep is /bin/grep. References: LPI Linux Essentials, type command
In compliance with the FHS, in which of the following directories are documentation files found?
/usr/share/documentation
/usr/local/share/documentation
/var/share/doc
/usr/share/doc
/etc/share/doc
According to the FHS (Filesystem Hierarchy Standard), the /usr/share/doc directory is used to store documentation files for various packages installed on the system. The documentation files may include README files, manuals, license agreements, changelogs, etc. The /usr/share/doc directory is intended to be read-only and independent of the machine architecture. The other directories are not compliant with the FHS or do not exist by default. The /usr/share/documentation directory is not a standard directory and may not be recognized by some applications. The /usr/local/share/documentation directory is also not a standard directory and may conflict with the /usr/local/share/doc directory, which is used for documentation files for locally installed packages. The /var/share/doc directory does not exist by default and is not a valid subdirectory of /var, which is used for variable data files. The /etc/share/doc directory does not exist by default and is not a valid subdirectory of /etc, which is used for configuration files. References:
LPI 101-500 Exam Objectives, Topic 101.3, Weight 2
LPI Learning Materials, Chapter 1.3, Finding Linux Documentation
Web Search Results, 1
Which of the following commands changes all occurrences of the word “bob” in file data to “Bob” and prints the result to standard output?
sed‘/bob/Bob’ data
sed‘s/bob/Bob/g’ data
sed‘s/bob/Bob/’ data
sed‘/bob/Bob/’ data
sed‘s/bob,Bob/’ data
The sed command is used to perform various text processing tasks on a file or a stream. The s command is used to substitute a pattern with a replacement. The g flag is used to replace all occurrences of the pattern in a line. The / character is used to separate the pattern, the replacement, and the flags. Therefore, the command sed‘s/bob/Bob/g’ data will change all occurrences of the word “bob” in file data to “Bob” and print the result to standard output. The other commands are incorrect because they either use the wrong syntax or do not replace all occurrences of the word “bob”. References:
LPI 101-500 Exam Objectives, Topic 103.7, Weight 4
LPI Learning Materials, Chapter 3.7, Basic Scripting
Web Search Results, 1
How can the list of files that would be installed by the RPM package file apache-xml.rpm be previewed?
rpm –qp apache-xml.rpm
rpm –qv apache-xml.rpm
rpm –ql apache-xml.rpm
rpm –qpl apache-xml.rpm
The command rpm -qpl apache-ql.rpm is used to preview the list of files that would be installed by the RPM package file apache-xml.rpm. This command queries the package file without installing it and lists the contents of the package. Here’s what each part of the command means:
rpm is the command-line tool used for managing RPM packages on Linux systems.
-qpl are options for the rpm command.
q stands for query mode
l stands for list the contents of the package.
p specifies that the package being queried is not installed, but is a file located on the system.
apache-xml.rpm is the name of the RPM package file you want to query.
So, when you run this command, it will display a list of all the files that are included in the apache-xml.rpm package file, without installing it. This can be useful for checking what files are included in the package before installing it or comparing it with another version of the package.
The other commands are either invalid or do not perform the same function as the correct answer. For example:
rpm -qp apache-xml.rpm will only display the name and version of the package, not the list of files.
rpm -qv apache-xml.rpm will display the verbose information about the package, such as the description, license, and changelog, but not the list of files.
rpm -ql apache-xml.rpm will list the files that are installed on the system by the apache-xml.rpm package, but only if the package is already installed. If the package is not installed, it will return an error.
What does the command mount -a do?
It mounts all available filesystems onto the current directory.
It shows all mounted filesystems.
It mounts all user mountable filesystems for the current user.
It mounts all filesystems listed in /etc/fstab which have the option auto set.
It mounts all filesystems listed in /etc/fstab which have the option noauto set.
The command mount -a mounts all filesystems that are listed in the file /etc/fstab and have the option auto set. The option auto means that the filesystem can be mounted automatically by the mount -a command or at boot time. The option noauto means that the filesystem can only be mounted explicitly by the mount command with the device or mount point specified12. The file /etc/fstab contains information about the filesystems that are known to the system and how they can be mounted3. The command mount -a is useful for mounting all the filesystems that are needed by the system after a change in /etc/fstab or after a reboot4. References: 1: mount(8) - Linux man page 2: Linux mount and umount commands help and examples 3: fstab(5) - Linux man page 4: How to Use the mount Command on Linux
Which umask value will result in the default access permissions of 600 (rw-------) for files and 700 (rwx------) for directories? (Specify only the numerical umask value.)
0077, 077
The umask value that will result in the default access permissions of 600 (rw-------) for files and 700 (rwx------) for directories is 077. This is because the umask value is an octal number that represents the permissions that are not given to the files or directories. To calculate the umask value, we need to subtract the desired permissions from the maximum permissions, which are 666 for files and 777 for directories. For example, if we want the files to have the permissions 600 (rw-------), which means read and write for the owner and no permissions for the group and others, we need to subtract 600 from 666, which gives us 066. Similarly, if we want the directories to have the permissions 700 (rwx------), which means read, write, and execute for the owner and no permissions for the group and others, we need to subtract 700 from 777, which gives us 077. The umask value is the minimum of these two values, which is 077. The first digit of the umask value is for the special permissions, such as setuid, setgid, and sticky bit, and it is usually set to 0. Therefore, the final umask value is 077. For more information on how to use the umask command, you can refer to the following articles:
What Is umask in Linux, and How Do You Use It? - How-To Geek
Umask command in Linux with examples - GeeksforGeeks
What is UMASK and how to set UMASK in Linux/Unix?
How to Set and Update the Default Umask Value - phoenixNAP
Which of the following properties of a Linux system should be changed when a virtual machine is cloned? (Choose two.)
The partitioning scheme
The file system
The D-Bus Machine ID
The permissions of /root/
The SSH host keys
The properties of a Linux system that should be changed when a virtual machine is cloned are the D-Bus Machine ID and the SSH host keys. The D-Bus Machine ID is a unique identifier for the system that is used by the D-Bus message bus system to communicate between applications. The D-Bus Machine ID is stored in the /etc/machine-id or /var/lib/dbus/machine-id file and it is generated during the first boot of the system. If a virtual machine is cloned without changing the D-Bus Machine ID, it can cause conflicts and errors with the D-Bus services on the clone and the original system. To change the D-Bus Machine ID, the file containing it must be deleted or emptied and the system must be rebooted12. The SSH host keys are cryptographic keys that are used by the SSH protocol to authenticate the identity of the system and establish a secure connection. The SSH host keys are stored in the /etc/ssh directory and they are generated during the first boot of the system or the installation of the openssh-server package. If a virtual machine is cloned without changing the SSH host keys, it can compromise the security and integrity of the SSH connections, as the clone and the original system will have the same keys. To change the SSH host keys, the files containing them must be deleted and the ssh-keygen command must be run to generate new keys34.
The other options are false or irrelevant. The partitioning scheme and the file system are not properties of a Linux system that need to be changed when a virtual machine is cloned, as they do not affect the functionality or the identity of the system. The permissions of /root/ are also not properties of a Linux system that need to be changed when a virtual machine is cloned, as they do not affect the security or the communication of the system. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute2
How to Clone Virtual Machine in VirtualBox - UbuntuMint3
Chapter 4. Cloning Virtual Machines Red Hat Enterprise Linux 7 | Red …4
Which of the following commands displays the path to the executable file that would be executed when the command foo is invoked?
lsattr foo
apropos foo
locate foo
whatis foo
which foo
This command will display the path to the executable file that would be executed when the command foo is invoked. The syntax of the command is:
which [options] command
The which command is a utility that searches the directories listed in the PATH environment variable for the executable file that matches the given command. The options can modify the behavior of the which command, such as displaying all matches, ignoring aliases, or showing the version. The command is the name of the command to be located.
Therefore, the command which foo will search the PATH directories for the executable file named foo and print its full path on the standard output. If there are multiple matches, the command will print the first one found. If there is no match, the command will print nothing and return an exit status of 1.
The other commands are incorrect for the following reasons:
A, lsattr foo: This command will not display the path to the executable file, but it will display the file attributes of the file named foo in the current directory. The syntax of the command is:
lsattr [options] [file]
The lsattr command is a utility that lists the file attributes on a Linux second extended file system. The options can modify the behavior of the lsattr command, such as displaying the output in long format, recursing into subdirectories, or suppressing errors. The file is the name of the file whose attributes are to be listed. If no file is given, the command will list the attributes of all files in the current directory.
Therefore, the command lsattr foo will list the file attributes of the file named foo in the current directory, if it exists. If it does not exist, the command will report an error and return an exit status of 1.
B, apropos foo: This command will not display the path to the executable file, but it will display a list of manual page names and descriptions that contain the keyword foo. The syntax of the command is:
apropos [options] keyword
The apropos command is a utility that searches the whatis database for the keyword and prints the manual page names and descriptions that match. The whatis database is a set of files containing short descriptions of system commands and programs. The options can modify the behavior of the apropos command, such as using regular expressions, ignoring case, or displaying the section numbers. The keyword is the word to be searched in the whatis database.
Therefore, the command apropos foo will search the whatis database for the word foo and print the manual page names and descriptions that contain it. If there are no matches, the command will print nothing and return an exit status of 1.
C, locate foo: This command will not display the path to the executable file, but it will display a list of file names that contain the string foo. The syntax of the command is:
locate [options] pattern
The locate command is a utility that searches a database of file names and prints the file names that match the given pattern. The database is updated periodically by the updatedb command and may not reflect the current state of the file system. The options can modify the behavior of the locate command, such as using regular expressions, ignoring case, or limiting the number of results. The pattern is the string to be matched in the file names.
Therefore, the command locate foo will search the database of file names and print the file names that contain the string foo. If there are no matches, the command will print nothing and return an exit status of 1.
D, whatis foo: This command will not display the path to the executable file, but it will display a short description of the command or program named foo. The syntax of the command is:
whatis [options] name
The whatis command is a utility that searches the whatis database for the name and prints the manual page name and description that match. The whatis database is a set of files containing short descriptions of system commands and programs. The options can modify the behavior of the whatis command, such as displaying the section numbers, using wildcards, or searching in a specific section. The name is the name of the command or program to be described.
Therefore, the command whatis foo will search the whatis database for the name foo and print the manual page name and description that match. If there are no matches, the command will print nothing and return an exit status of 1.
Which of the following is true regarding the command sendmail?
With any MTA, the sendmail command must be run periodically by the cron daemon.
When using systemd, sendmail is an alias to relayctl.
The sendmail command prints the MTA's queue history of which mails have been sent successfully.
It is only available when the sendmail MTA is installed.
All common MTAs, including Postfix and Exim, provide a sendmail command.
Which of the following tasks are handled by a display manager like XDM or KDM? (Choose TWO correct answers.)
Configure additional devices like new monitors or projectors when they are attached
Start and prepare the desktop environment for the user
Create an X11 configuration file for the current graphic devices and monitors
Lock the screen when the user was inactive for a configurable amount of time
Handle the login of a user
Which command displays the current disk space usage for all mounted file systems? (Specify ONLY the command without any path or parameters.)
df
The command df displays the current disk space usage for all mounted file systems. It shows the size, used space, available space, percentage of usage, and mount point of each file system. By default, the output is in 1K blocks, but it can be changed with options like -h (human-readable), -B (block size), -i (inodes), and -T (type). The command df is part of the 101.1 Determine and configure hardware settings topic of the LPI Linux Essentials certification program12. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute
Which of the following commands changes all CR-LF line breaks in the text file userlist.txt to Linux standard LF line breaks and stores the result in newlist.txt?
tr –d ‘\r’ < userlist.txt > newlist.txt
tr –c ‘\n\r’ ‘’
tr ‘\r\n’ ‘’
tr ‘\r’ ‘\n’ userlist.txt newlist.txt
tr –s ‘/^M/^J/’ userlist.txt newlist.txt
The correct answer is A, tr -d ‘\r’ < userlist.txt > newlist.txt. This command will use the tr utility to delete the carriage return characters (\r) from the userlist.txt file and redirect the output to the newlist.txt file. The tr utility is used to translate, delete, or squeeze characters from the standard input and write the result to the standard output. The syntax of the tr command is:
tr [options] set1 [set2]
The options can modify the behavior of the tr command, such as complementing, squeezing, or truncating the sets of characters. The set1 and set2 are strings of characters that specify the translation to be performed. The characters in set1 are replaced by the corresponding characters in set2. If set2 is omitted, the characters in set1 are deleted.
The -d option tells tr to delete the characters in set1 from the output. The \r character is a special escape sequence that represents the carriage return character, which is used in Windows systems to mark the end of a line, along with the line feed character (\n). The < and > symbols are redirection operators that redirect the input and output of a command to a file or device. The < symbol redirects the standard input of a command from a file, while the > symbol redirects the standard output of a command to a file, overwriting any existing content.
Therefore, the command tr -d ‘\r’ < userlist.txt > newlist.txt will read each character from the userlist.txt file, delete any carriage return characters, and write the output to the newlist.txt file. This will effectively change all CR-LF line breaks (\r\n) in the userlist.txt file to Linux standard LF line breaks (\n) and store the result in newlist.txt.
The other commands are incorrect for the following reasons:
B, tr -c ‘\n\r’ ‘’
C, tr ‘\r\n’ ‘’
D, tr ‘\r’ ‘\n’ userlist.txt newlist.txt: This command will not work as expected, because it has several errors. First, the set1 and set2 in this command are ‘\r’ and ‘\n’, which means that tr will replace the carriage return characters with the line feed characters, not delete them. Second, the redirection operators are missing, which means that tr will not read the input from the userlist.txt file or write the output to the newlist.txt file, but instead it will expect the input from the standard input and write the output to the standard output. Third, the userlist.txt and newlist.txt are treated as additional arguments that will cause an error. Therefore, the command tr ‘\r’ ‘\n’ userlist.txt newlist.txt will replace all the carriage return characters with the line feed characters from the standard input and write the output to the standard output, and report an error for the extra arguments.
E, tr -s ‘/M/J/’ userlist.txt newlist.txt: This command will not work as expected, because it has several errors. First, the -s option tells tr to squeeze the repeated characters in set1 with a single occurrence, not delete them. Second, the set1 in this command is ‘/M/J/’, which is not a valid escape sequence for the carriage return and the line feed characters. The correct escape sequences are ‘\r’ and ‘\n’, respectively. Third, the redirection operators are missing, which means that tr will not read the input from the userlist.txt file or write the output to the newlist.txt file, but instead it will expect the input from the standard input and write the output to the standard output. Fourth, the userlist.txt and newlist.txt are treated as additional arguments that will cause an error. Therefore, the command tr -s ‘/M/J/’ userlist.txt newlist.txt will squeeze the repeated occurrences of the characters /, ^, M, and J from the standard input and write the output to the standard output, and report an error for the extra arguments.
Which of the following states can NetworkManager show regarding the system's network connectivity? (Choose TWO correct answers.)
up
portal
full
login-required
firewalled
Which of the following files, located in a user’s home directory, contains the Bash history?
.bashrc_history
.bash_histfile
.history
.bash_history
.history_bash
The correct answer is D, .bash_history. This file, located in a user’s home directory, contains the Bash history, which is a list of commands that the user has entered in the Bash shell. The syntax of the file is:
~/.bash_history
The ~ symbol represents the user’s home directory, which is usually /home/username. The / symbol is a directory separator that separates the components of a path. The . symbol at the beginning of the file name indicates that the file is hidden, which means that it is not normally displayed by the ls command or the file manager, unless the -a option or the show hidden files option is used. The bash_history is the name of the file that stores the Bash history.
The Bash history is maintained by the Bash shell while it is running, and it is written to the .bash_history file when the shell exits or when the history -a or -w options are used. The history command can be used to display, manipulate, or search the Bash history. The HISTFILE variable can be used to change the name or location of the .bash_history file. The HISTSIZE and HISTFILESIZE variables can be used to change the number of commands that are stored in the Bash history and the .bash_history file, respectively.
The other files are incorrect for the following reasons:
A, .bashrc_history: This file does not exist by default, and it is not used to store the Bash history. The .bashrc file is a configuration file that is executed by the Bash shell when it starts in interactive mode. It can contain commands, aliases, functions, variables, or other settings that affect the behavior of the shell. However, it is not used to store the history of the commands that the user has entered.
B, .bash_histfile: This file does not exist by default, and it is not used to store the Bash history. The .bash_histfile file is not a standard file name, and it is not recognized by the Bash shell. The Bash shell uses the .bash_history file to store the history of the commands that the user has entered, unless the HISTFILE variable is changed to a different file name.
C, .history: This file does not exist by default, and it is not used to store the Bash history. The .history file is not a standard file name, and it is not recognized by the Bash shell. The Bash shell uses the .bash_history file to store the history of the commands that the user has entered, unless the HISTFILE variable is changed to a different file name.
E, .history_bash: This file does not exist by default, and it is not used to store the Bash history. The .history_bash file is not a standard file name, and it is not recognized by the Bash shell. The Bash shell uses the .bash_history file to store the history of the commands that the user has entered, unless the HISTFILE variable is changed to a different file name.
What information related to a user account is modified using the chage command?
Default ownership for new files
Group membership
Set of commands available to the user
Password expiry information
Default permissions for new files
What is true regarding the statement beginning with #! that is found in the first line of a script? (Choose TWO correct answers.)
It prevents the script from being executed until the \ is removed
It triggers the installation of the scripts interpreter
It specifies the path and the arguments of the interpreter used to run the script
It defines the character encoding of the script
It is a comment that is ignored by the script interpreter
Which of the following commands puts the output of the command date into the shell variable mydate?
mydate=''date"
mydate="exec date"
mydate="$ ((dare))"
mydate=$(date)"
mydate="${date}"
When considering the use of hard links, what are valid reasons not to use hard links?
Hard links are not available on all Linux systems because traditional filesystems, such as ext4, do not support them
Each hard link has individual ownership, permissions and ACLs which can lead to unintended disclosure of file content
Hard links are specific to one filesystem and cannot point to files on another filesystem
If users other than root should be able to create hard links, suln has to be installed and configured
When a hard linked file is changed, a copy of the file is created and consumes additional space
The only valid reason not to use hard links is that they are specific to one filesystem and cannot point to files on another filesystem. This means that if you want to link files across different partitions or devices, you cannot use hard links. You have to use symbolic links instead, which are pointers to file names rather than inodes. The other options are either false or irrelevant. Hard links are available on most Linux systems and traditional filesystems, such as ext4, do support them1. Each hard link shares the same ownership, permissions and ACLs as the original file, which can be an advantage or a disadvantage depending on the use case2. There is no such thing as suln, and users other than root can create hard links as long as they have write permission on the directory where the link is created3. When a hard linked file is changed, no copy of the file is created and no additional space is consumed. The changes are reflected on all the hard links pointing to the same inode4. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute2
Hard links and soft links in Linux explained | Enable Sysadmin3
Hard Link in Linux: Everything Important You Need to Know4
Which of the following commands sets the system's time zone to the Canadian Eastern Time?
localegen -t -f /usr/share/zoneinfo/Canada/Eastern > /etc/locale.tz
tzconf /etc/localtime
sysctl -w clock.tz='Canada/Eastern'
modprobe tz_ca_est
ln -sf /usr/share/zoneinfo/Canada/Eastern /etc/localtime
After editing the TCP wrapper configuration to grant specific hosts access to a service when do these changes become effective?
The new configuration becomes effective after restarting the respective service
The new configuration becomes effective at the next system reboot
The new configuration becomes effective when the last established connection to the service is closed
The new configuration becomes effective after restarting the tcpd service
The new configuration becomes effective immediately for all new connections
Consider the following directory:
drwxrwxr-x 2 root sales 4096 Jan 1 15:21 sales
Which command ensures new files created within the directory sales are owned by the group sales? (Choose two.)
chmod g+s sales
setpol –R newgroup=sales sales
chgrp –p sales sales
chown --persistent *.sales sales
chmod 2775 sales
The command chmod g+s sales sets the setgid bit on the directory sales, which means that any new file or subdirectory created within sales will inherit the group ownership of the directory. The command chmod 2775 sales does the same thing, but also sets the permissions of the directory to rwxrwxr-x, which means that the owner, group, and others can read, write, and execute files in the directory. Both commands ensure that new files created within the directory sales are owned by the group sales. The other commands are either invalid or do not affect the group ownership of new files. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute
What is true regarding UEFI firmware? (Choose two.)
It can read and interpret partition tables
It can use and read certain file systems
It stores its entire configuration on the /boot/ partition
It is stored in a special area within the GPT metadata
It is loaded from a fixed boot disk position
UEFI firmware is a software program that provides the interface between the hardware and the operating system on a computer. UEFI stands for Unified Extensible Firmware Interface and it is a replacement for the traditional BIOS (Basic Input/Output System). UEFI firmware has several advantages over BIOS, such as faster boot times, better security, larger disk support, and graphical user interface. Some of the features of UEFI firmware are12:
It can use and read certain file systems: UEFI firmware can access files on partitions formatted with FAT12, FAT16, or FAT32 file systems. This allows UEFI to load boot loaders, kernels, and configuration files from these partitions without relying on the legacy MBR (Master Boot Record) or boot sector code. UEFI firmware can also support other file systems, such as NTFS or ext4, with additional drivers.
It is loaded from a fixed boot disk position: UEFI firmware is stored in a ROM chip on the motherboard, but it also requires a special partition on the boot disk to store additional files and drivers. This partition is called the EFI System Partition (ESP) and it is usually the first partition on the disk. The ESP must have a specific GUID (Globally Unique Identifier) and must be formatted with a FAT file system. The UEFI firmware will look for the ESP on the boot disk and load the files from there.
The other options are false or irrelevant. UEFI firmware does not read and interpret partition tables, it relies on the operating system to do that. UEFI firmware does not store its entire configuration on the /boot/ partition, it stores some of its settings in the NVRAM (Non-Volatile Random Access Memory) on the motherboard and some of its files on the ESP. UEFI firmware is not stored in a special area within the GPT (GUID Partition Table) metadata, it is stored in a ROM chip and an ESP. GPT is a partitioning scheme that supports larger disks and more partitions than the legacy MBR scheme. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute2
How to Boot and Install Linux on a UEFI PC With Secure Boot3
How to Access UEFI Settings From Linux - It’s FOSS4
UEFI firmware updates for linux-surface - GitHub5
What does the term Braille Display refer to?
A standardized high contract graphical theme for desktop applications
A Linux desktop environment similar to KDE and GNOME
A legacy display technology superseded by LCD
A physical representation of characters using small dots
A standard file format for data exchange, similar to XML
Which wildcards will match the following filenames? (Choose two.)
ttyS0
ttyS1
ttyS2
ttyS[1-5]
tty?[0-5]
tty*2
tty[A-Z][012]
tty[Ss][02]
[character list] matches any one of the characters in the list. ? matches any single character. * matches any number of characters, including none.
Therefore, the wildcard ttyS[1-5] will match any filename that starts with ttyS and ends with a digit from 1 to 5, such as ttyS1, ttyS2, ttyS3, ttyS4, or ttyS5. However, it will not match ttyS0, which has a 0 at the end.
The wildcard tty?[0-5] will match any filename that starts with tty, followed by any single character, followed by a digit from 0 to 5, such as ttyS0, ttyS1, ttyS2, ttyA0, ttyB5, or ttyZ4. This wildcard will match all the given filenames.
The wildcard tty*2 will match any filename that starts with tty and ends with 2, such as ttyS2, ttyA2, ttyB2, or ttyZZZ2. This wildcard will match ttyS2, but not the other two filenames.
The wildcard tty[A-Z][012] will match any filename that starts with tty, followed by a capital letter from A to Z, followed by a digit from 0 to 2, such as ttyA0, ttyB1, ttyC2, ttyZ0, or ttyZ2. This wildcard will match ttyS0 and ttyS2, but not ttyS1, which has a 1 at the end.
The wildcard tty[Ss][02] will match any filename that starts with tty, followed by either S or s, followed by either 0 or 2, such as ttyS0, ttyS2, ttys0, or ttys2. This wildcard will match ttyS0 and ttyS2, but not ttyS1, which has a 1 at the end.
Which world-writable directory should be placed on a separate partition in order to prevent users from being able to fill up the / filesystem? (Specify the full path to the directory.)
/tmp
Answer:tmp,
Answer:/var/tmp/
Answer:/var/tmp/
Answer:A
The world-writable directory that should be placed on a separate partition in order to prevent users from being able to fill up the / filesystem is /tmp. This directory is used by applications and users to store temporary files, and it is world-writable by default. By creating a separate partition for /tmp, the amount of space available to users is limited, and the root filesystem is protected from being filled up by temporary files1.
To create a separate partition for /tmp, you can use the fdisk or parted command to create a new partition on the disk. Once the partition is created, you can format it with a filesystem such as ext4, and then mount it to the /tmp directory using the mount command. Finally, you can modify the /etc/fstab file to ensure that the partition is mounted automatically at boot time1. Here is an example of the steps to create a separate partition for /tmp:
After completing these steps, the /tmp directory will be mounted on a separate partition, and users will be limited in the amount of space they can use for temporary files.
When removing a package, which of the following dpkg options will completely remove the files including configuration files?
--clean
--delete
--purge
–remove
When removing a package on a system using dpkg package management, the --purge option ensures that configuration files are removed as well. The --purge option is equivalent to the --remove option followed by the --purge-config-files option, which removes any configuration files that are marked as obsolete. The --remove option only removes the package files, but leaves the configuration files intact. The --clean option removes any .deb files from the local cache, but does not affect the installed packages. The --delete option is not a valid option for dpkg. References:
1, 102.4 Lesson 1
3, 101-500 Exam - Free Questions and Answers - ITExams.com
man dpkg
When using rpm --verify to check files created during the installation of RPM packages, which of the following information is taken into consideration? (Choose THREE correct answers.)
Timestamps
MD5 checksums
Inodes
File sizes
GnuPG signatures
When using rpm --verify to check files created during the installation of RPM packages, the following information is taken into consideration:
Timestamps. RPM compares the modification time of the installed files with the original time stored in the RPM database. If the file has been modified after installation, the timestamp will differ and RPM will report it with an M flag1.
MD5 checksums. RPM calculates the MD5 checksum of the installed files and compares it with the original checksum stored in the RPM database. If the file has been altered in any way, the checksum will differ and RPM will report it with an 5 flag1.
File sizes. RPM compares the size of the installed files with the original size stored in the RPM database. If the file has been truncated or appended, the size will differ and RPM will report it with an S flag1.
RPM does not take into consideration the following information:
Inodes. RPM does not check the inode number of the installed files, as it is not a reliable indicator of file identity. The inode number can change if the file is moved, copied, or restored from a backup2.
GnuPG signatures. RPM does not verify the GnuPG signatures of the installed files, as they are not part of the RPM package format. The GnuPG signatures are used to verify the authenticity and integrity of the RPM package files before installation, not after3.
Which of the following commands can be used to perform a full text search on all available packages on a Debian system?
apt
apt-cache
apt-get
apt-search
dpkg
The command apt-cache can be used to perform a full text search on all available packages on a Debian system. It searches the package names and the descriptions for an occurrence of the regular expression given as a keyword and prints out the package name and the short description1. The syntax is: apt-cache search keyword. For example, apt-cache search openssh will return a list of packages related to OpenSSH2. The other commands are not suitable for this task because:
apt is a high-level command-line tool that provides a user-friendly way to manage packages, but it does not have a search option3.
apt-get is a low-level command-line tool that handles the installation and removal of packages, but it does not have a search option4.
apt-search is not a valid command.
dpkg is a tool to install, build, remove and manage Debian packages, but it does not have a search option5. It can only list the installed packages with the option -l4. References:
How To Search For Available Packages From Command Line In Debian, Ubuntu Or Linux Mint [APT] - Linux Uprising Blog
apt(8) — apt — Debian buster — Debian Manpages
How to List Installed Packages on Debian | Linuxize
Debian / Ubuntu Linux search package names with apt-cache command
dpkg(1) — dpkg — Debian buster — Debian Manpages
Which option to the yum command will update the entire system? (Specify ONLY the option name without any additional parameters.)
update
upgrade
update/upgrade
The yum command is a tool for managing software packages on Red Hat Enterprise Linux and other RPM-based systems. The yum update option will update the entire system by checking the versions of the installed packages and installing the latest available versions from the repositories. The yum upgrade option will do the same, but it will also remove any obsolete packages that are no longer needed by the system. Both options will prompt the user to confirm before proceeding with the update or upgrade process. References:
Yum Command Cheat Sheet for Red Hat Enterprise Linux
"yum update" Explained for Beginners!
How to Install Updates on CentOS 7
Which option to the yum command will update the entire system?
What is the name of the main configuration file for GNU GRUB? (Specify the file name only without any path.)
menu.lst
grub.conf
grub.cfg
C
The main configuration file for GNU GRUB is grub.cfg, which is usually located in /boot/grub/ or /boot/grub2/ depending on the distribution. This file contains the menu entries for the boot loader, each with a title, a kernel image, an initrd image, and optional parameters. The grub.cfg file is not meant to be edited manually, as it is generated by the grub-mkconfig command, which reads the settings from /etc/default/grub and the scripts in /etc/grub.d/. The /etc/default/grub file contains the global options for GRUB, such as the default menu entry, the timeout, the theme, etc. The /etc/grub.d/ directory contains executable scripts that are run by grub-mkconfig to generate the menu entries for each operating system or kernel found on the system. For example, the script 10_linux generates the entries for the Linux kernels installed by the package manager, while the script 30_os-prober generates the entries for other operating systems detected on the system, such as Windows. To make changes to the GRUB configuration, one should edit the /etc/default/grub file and/or the scripts in /etc/grub.d/, and then run grub-mkconfig -o /boot/grub/grub.cfg to update the grub.cfg file. References:
2, 102.2 Install a boot manager
4, 102.2 Install a boot manager
man grub-mkconfig
You want to preview where the package file, apache-xml.i386.rpm, will install its files before installing it. What command do you issue?
rpm -qp apache-xml.i386.rpm
rpm -qv apache-xml.i386.rpm
rpm -ql apache-xml.i386.rpm
rpm -qpl apache-xml.i386.rpm
To prevent users from being able to fill up the / partition, the ____________ directory should be on a separate partition if possible because it is world writeable.
/tmp
tmp
The /tmp directory should be on a separate partition if possible because it is world writable. This means that any user can create, modify, or delete files and directories in /tmp. This can pose a risk of filling up the / partition, which can cause system instability or failure. By having /tmp on a separate partition, we can limit the amount of disk space that can be used by temporary files and prevent users from affecting the / partition. The /tmp directory is also a common target for malicious attacks, so having it on a separate partition can improve the security and isolation of the system. The /tmp directory is one of the few directories that are world writable by default, according to the Filesystem Hierarchy Standard (FHS)1. The other directories that are usually world writable are /var/tmp and /var/lock, which are also used for temporary or lock files. However, these directories are not as frequently used or as large as /tmp, so they are less likely to fill up the / partition. The /tmp directory also has the sticky bit set, which means that only the owner of a file or directory can delete or rename it2. This prevents users from deleting or modifying other users’ files in /tmp. However, this does not prevent users from creating new files or directories in /tmp, which can still consume disk space and resources. Therefore, it is advisable to have /tmp on a separate partition if possible. References:
Filesystem Hierarchy Standard
Sticky bit - Wikipedia
Which of the following options is used in a GRUB Legacy configuration file to define the amount of time that the GRUB menu will be shown to the user?
hidemenu
splash
timeout
showmenu
The timeout option in a GRUB Legacy configuration file is used to define the amount of time (in seconds) that the GRUB menu will be shown to the user before booting the default entry. The timeout option is usually located in the /boot/grub/menu.lst file. For example, timeout 10 will display the GRUB menu for 10 seconds. To disable the timeout and wait for user input indefinitely, the value of timeout can be set to -1. To boot immediately without displaying the menu, the value of timeout can be set to 0. The other options are not valid for the GRUB Legacy configuration file. References:
GRUB Legacy - ArchWiki
How do I set the grub timeout and the grub default boot entry?
How to Remove the Timeout From GRUB Menu
Which RPM command will output the name of the package which supplied the file /etc/exports?
rpm -F /etc/exports
rpm -qf /etc/exports
rpm -Kl /etc/exports
rpm -qp /etc/exports
rpm -qi/etc/exports
The RPM command that will output the name of the package which supplied the file /etc/exports is rpm -qf /etc/exports. This command will query the RPM database and find the package that owns or provides the file /etc/exports1. The output will show the package name, version, release, and architecture. For example:
The other options are incorrect for the following reasons:
rpm -F /etc/exports. This command will try to freshen or upgrade the package that contains the file /etc/exports, if it is already installed2. This command will not output the package name, but rather install the latest version of the package from a specified source. For example:
rpm -Kl /etc/exports. This command is not valid, as RPM does not have a -Kl option. The -K option is used to verify the signatures of the RPM package files, not the installed files3. The -l option is used to list the files in a package, not to query the package name. For example:
rpm -qp /etc/exports. This command will try to query the package information of the file /etc/exports, as if it was an RPM package file. This command will not output the package name, but rather an error message, as /etc/exports is not a valid RPM package file. For example:
rpm -qi /etc/exports. This command will try to query the information of the package /etc/exports, as if it was an installed package name. This command will not output the package name, but rather an error message, as /etc/exports is not a valid package name. For example:
Typically, which top level system directory is used for files and data that change regularly while the system is running and are to be kept between reboots? (Specify only the top level directory)
/var
/var/,
Var
var/
The top-level system directory that is used for files and data that change regularly while the system is running and are to be kept between reboots is /var. The /var directory contains variable data that changes in size as the system runs. For instance, log files, mail directories, databases, and printing spools are stored in /var. These files and data are not temporary and need to be preserved across system reboots. The /var directory is one of the few directories that are recommended to be on a separate partition, according to the Filesystem Hierarchy Standard (FHS)1. This is because the /var directory can grow unpredictably and fill up the / partition, which can cause system instability or failure. By having /var on a separate partition, we can limit the amount of disk space that can be used by variable data and prevent users from affecting the / partition. The /var directory is also a common target for malicious attacks, so having it on a separate partition can improve the security and isolation of the system. References:
Filesystem Hierarchy Standard
Which function key is used to start Safe Mode in Windows NT?
F10
F8
F6
Windows NT does not support Safe Mode
The function key that is used to start Safe Mode in Windows NT is none of the above, because Windows NT does not support Safe Mode. Safe Mode is a diagnostic mode of Windows that starts the system with minimal drivers and services, allowing the user to troubleshoot problems and restore the system to a normal state1. Safe Mode was introduced in Windows 95 and later versions, but not in Windows NT 4.0 and earlier2.
The other options are incorrect for the following reasons:
F10. This function key is used to access the Recovery Console in Windows XP, which is a command-line interface that allows the user to perform various administrative tasks, such as repairing the boot sector, restoring the registry, or copying files3. The Recovery Console is not the same as Safe Mode, and it is not available in Windows NT.
F8. This function key is used to access the Advanced Boot Options menu in Windows Vista and later versions, which allows the user to choose from various boot modes, including Safe Mode, Last Known Good Configuration, Debugging Mode, and others4. In Windows NT, pressing F8 during startup only displays a simple menu with three options: Normal, VGA mode, and Boot Logging5. None of these options are equivalent to Safe Mode.
F6. This function key is used to load additional drivers during the installation of Windows, such as SCSI or RAID drivers, from a floppy disk or a USB flash drive6. This function key has nothing to do with Safe Mode, and it is not relevant after the installation is completed.
Which of the following environment variables overrides or extends the list of directories holding shared libraries?
LD_LOAD_PATH
LD_LIB_PATH
LD_LIBRARY_PATH
LD_SHARE_PATH
LD_RUN_PATH
The environment variable that overrides or extends the list of directories holding shared libraries is LD_LIBRARY_PATH. This variable is used to specify a colon-separated list of directories where the dynamic linker should look for shared libraries when loading a program1. The directories in LD_LIBRARY_PATH are searched before the default directories, such as /lib and /usr/lib, or the directories specified in /etc/ld.so.conf or the executable’s rpath1. This variable can be useful for testing or debugging purposes, or for running programs that require a specific version of a library that is not installed in the system1.
The other options are incorrect for the following reasons:
LD_LOAD_PATH. This is not a standard environment variable for shared libraries. It may be confused with LD_PRELOAD, which is a variable that allows the user to specify one or more shared libraries that should be loaded before any other library, even the C library2. This variable can be used to override or modify the behavior of certain functions or symbols in the libraries2.
LD_LIB_PATH. This is not a standard environment variable for shared libraries. It may be confused with LIBPATH, which is a variable that is used on some Unix variants, such as AIX, to specify the search path for shared libraries3. On Linux, this variable has no effect4.
LD_SHARE_PATH. This is not a standard environment variable for shared libraries. It may be confused with LD_RUN_PATH, which is a variable that allows the user to specify a list of directories that should be embedded in the executable as the rpath5. The rpath is a attribute that tells the dynamic linker where to look for shared libraries at run time5. Unlike LD_LIBRARY_PATH, LD_RUN_PATH is only effective at link time, not at run time5.
LD_RUN_PATH. This is not an environment variable that overrides or extends the list of directories holding shared libraries, but rather one that sets the rpath of the executable at link time. See the explanation for LD_SHARE_PATH above.
Which of the following is correct when talking about mount points?
Every existing directory can be used as a mount point.
Only empty directories can be used as a mount point.
Directories need to have the SetUID flag set to be used as a mount point.
Files within a directory are deleted when the directory is used as a mount point.
The correct answer when talking about mount points is that every existing directory can be used as a mount point. A mount point is a directory in the Linux file-system where a file system, partition, or storage device can be attached and accessed1. To create a mount point, you need root privileges. Mounting means making the contents of the attached file system, partition, or storage device available in the mount point directory1.
The other options are incorrect for the following reasons:
Only empty directories can be used as a mount point. This is not true, as any directory can be used as a mount point, regardless of whether it contains files or not. However, if the directory is not empty, the files inside it will be hidden by the mounted file system until it is unmounted2. Therefore, it is recommended to use empty directories as mount points to avoid confusion and data loss2.
Directories need to have the SetUID flag set to be used as a mount point. This is not true, as the SetUID flag is a special permission that allows a file to be executed with the privileges of its owner, regardless of who runs it3. This flag has nothing to do with mounting file systems, and it is not required for a directory to be used as a mount point4.
Files within a directory are deleted when the directory is used as a mount point. This is not true, as the files within a directory are not deleted when the directory is used as a mount point. They are only hidden by the mounted file system until it is unmounted2. The files are still present on the disk and can be recovered by unmounting the file system or using another mount point to access them2.
Which command will disable swapping on a device? (Specify ONLY the command without any path or parameters.)
Swapoff
/sbin/swapoff
A
The swapoff command is used to disable swapping on a device or a file. It takes the path of the device or file as an argument, or -a to disable all swaps. Disabling swap can improve the performance of the system if there is enough physical memory, or it can be necessary if the swap size needs to be changed. However, disabling swap can also cause problems if the system runs out of memory and has no swap space to use. References:
How to Disable Swap in Linux - Linux Handbook
How to Permanently Disable Swap in Linux? - GeeksforGeeks
LPI Linux Essentials - 1.1 Operating System Basics
Copyright © 2014-2025 Certensure. All Rights Reserved