LPIC-1 Exam 101, Part 1 of 2, version 5.0 Questions and Answers
In compliance with the FHS, in which of the directories are man pages found?
Options:
/usr/share/man
/opt/man
/usr/doc/
/var/pkg/man
/var/man
Answer:
AExplanation:
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]
: 6
The /etc/_______ file lists currently mounted devices.
Options:
Answer:
mtab
Explanation:
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.
Which of the following commands replaces each occurrence of 'bob' in the file letter with 'Bob' and writes the result to the file newletter?
Options:
sed '/bob/Bob' letter > newletter
sed s/bob/Bob/ letter < newletter
sed's/bob/Bob' letter > newletter
sed 's/bob/Bob/g' letter > newletter
sed 's/bob, Bob/' letter > newletter
Answer:
DExplanation:
The command that replaces each occurrence of ‘bob’ in the file letter with ‘Bob’ and writes the result to the file newletter is sed ‘s/bob/Bob/g’ letter > newletter. This command uses the following options and syntax:
s: Specifies the substitution operation.
/: Separates the pattern and the replacement strings.
bob: The pattern to be searched and replaced.
Bob: The replacement string.
g: The global flag that indicates all occurrences of the pattern in each line should be replaced, not just the first one.
letter: The name of the input file.
: Redirects the output to a file.
newletter: The name of the output file.
The output of this command will be a new file called newletter that contains the same text as letter, except that every ‘bob’ is replaced by ‘Bob’. For example, if the file letter contains the following text:
Dear bob, I hope this letter finds you well. I am writing to inform you that your subscription to our magazine has expired. If you wish to renew it, please send us a check for $50 by the end of this month. Otherwise, we will have to cancel your subscription and remove you from our mailing list. Thank you for your cooperation and support. Sincerely, Alice
The file newletter will contain the following text:
Dear Bob, I hope this letter finds you well. I am writing to inform you that your subscription to our magazine has expired. If you wish to renew it, please send us a check for $50 by the end of this month. Otherwise, we will have to cancel your subscription and remove you from our mailing list. Thank you for your cooperation and support. Sincerely, Alice
The other commands are incorrect for the following reasons:
A. sed ‘/bob/Bob’ letter > newletter: This command is missing the s option and the second / delimiter, and will produce an error message.
B. sed s/bob/Bob/ letter < newletter: This command is using the wrong redirection operator (< instead of >), and will try to read the input from newletter instead of letter, and write the output to the standard output instead of newletter.
C. sed’s/bob/Bob’ letter > newletter: This command is missing a space between sed and the first ', and will produce an error message.
E. sed ‘s/bob, Bob/’ letter > newletter: This command is using a comma (,) instead of a slash (/) as a delimiter, and will produce an error message.
Which command displays a list of all background tasks running in the current shell? (Specify ONLY the command without any path or parameters.)
Options:
Answer:
jobs
Explanation:
The jobs command displays a list of all background tasks running in the current shell. A background task is a process that is started with the & operator or suspended with Ctrl+Z and resumed with the bg command. The jobs command shows the job number, the status, and the command name of each background task. For example, the following output shows two background tasks: one is running (sleep 10) and one is stopped (ping
1- Running sleep 10 & 2+ Stopped ping
In a nested directory structure, which find command line option would be used to restrict the command to searching down a particular number of subdirectories?
Options:
-dirmax
-maxdepth
-maxlevels
-n
-s
Answer:
BExplanation:
The find command is used to search for files and directories that match certain criteria. The option -maxdepth can be used to restrict the command to searching down a particular number of subdirectories. The argument to -maxdepth is a positive integer that specifies the maximum depth of the directory tree to be searched. For example, -maxdepth 0 means only the current directory, -maxdepth 1 means the current directory and its direct subdirectories, and so on1. The option -maxdepth should be placed before any other expressions, as it affects the behavior of the whole command2. For example, to find all the files with the extension .txt in the current directory and its direct subdirectories, the command would be:
find . -maxdepth 1 -type f -name “*.txt”
The other options are not correct because:
A. -dirmax is not a valid find option.
C. -maxlevels is not a valid find option.
D. -depth is a valid find option, but it does not restrict the command to searching down a particular number of subdirectories. It only changes the order of the search, so that the files and directories are processed in depth-first order, meaning that the contents of a directory are processed before the directory itself1. References:
find(1) — Linux manual page
How to use find command to search for multiple extensions - Unix & Linux Stack Exchange
Which of the following sequences in the vi editor saves the opened document and exits the editor? (Choose TWO correct answers.)
Options:
esc ZZ
ctrl :w!
esc zz
esc :wq!
ctrl XX
Answer:
A, DExplanation:
To save a file and exit the vi/vim editor, you need to switch to command mode by pressing the Esc key, then type a colon (:) followed by a command. There are two commands that can save a file and quit the editor: x and wq. The x command writes the buffer to the file only if there are unsaved changes, while the wq command always writes the buffer to the file and updates the file modification time. Both commands are followed by an exclamation mark (!) to force the operation and override any warnings. Therefore, the correct sequences are:
Esc ZZ: This is equivalent to typing :x and hitting Enter.
Esc :wq!: This writes the buffer to the file and quits the editor, ignoring any warnings.
The other options are incorrect because:
Ctrl :w! is not a valid sequence. The Ctrl key does not switch to command mode, and the w command only saves the file without exiting.
Esc zz is not a valid sequence. The zz command does not exist in vi/vim.
Ctrl XX is not a valid sequence. The Ctrl key does not switch to command mode, and the XX command does not exist in vi/vim.
You are trying to make a hard link to an ordinary file but ln returns an error. Which of the following could cause this?
Options:
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.
Answer:
EExplanation:
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)
Which of the following commands moves and resumes in the background the last stopped shell job?
Options:
run
bg
fg
back
Answer:
BExplanation:
The bg command is used to move and resume in the background the last stopped shell job. A stopped job is a process that has been suspended by using Ctrl+Z or the kill -STOP command. The bg command will resume the execution of the stopped job and allow it to run in the background, without blocking the current shell. The bg command can also take a job number as an argument, which can be obtained by using the jobs command. For example, if the last stopped job is 1+ Stopped sleep 500, then the following command will move and resume it in the background:
bg %1
The output will be:
1+ sleep 500 &
The fg command is used to move and resume in the foreground the last stopped or backgrounded job. The run and back commands are not valid commands in Linux. References:
[LPI Exam 101 Detailed Objectives], Topic 103: GNU and Unix Commands, Objective 103.5: Create, monitor and kill processes, Weight: 4, Key Knowledge Areas: Use of jobs, fg and bg commands.
Linux Commands: jobs, bg, and fg, Topic: The bg Command.
What is the difference between the i and a command of the vi editor?
Options:
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.
Answer:
BExplanation:
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)
When given the following command line.
echo "foo bar" | tee bar | cat
Which of the following output is created?
Options:
cat
foo bar
tee bar
bar
foo
Answer:
BExplanation:
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 happens after issuing the command vi without any additional parameters?
Options:
vi starts and loads the last file used andmoves the cursor to the position where vi was when it last exited.
vi starts and requires the user to explicitly either create a new or load an existing file.
vi exits with an error message as it cannot be invoked without a file name to operate on.
vi starts in command mode and opens a new empty file.
vi starts and opens a new file which is filled with the content of the vi buffer if the buffer contains text.
Answer:
DExplanation:
The vi command is a text editor that operates in two modes: command mode and insert mode. Command mode is used to enter commands to manipulate the text, such as saving, quitting, copying, pasting, etc. Insert mode is used to enter text into the file. When the vi command is invoked without any additional parameters, it starts in command mode and opens a new empty file. To enter text, the user has to press i to switch to insert mode. To return to command mode, the user has to press Esc. To save and quit, the user has to enter :wq in command mode. The other options are either incorrect or not applicable. The vi command does not load the last file used or the content of the vi buffer by default. It also does not require the user to explicitly create or load a file. It does not exit with an error message unless there is a problem with the terminal or the system. References:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.7 Use and edit text files
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
What command will generate a list of user names from /etc/passwd along with their login shell?
Options:
column -s : 1,7 /etc/passwd
chop -c 1,7 /etc/passwd
colrm 1,7 /etc/passwd
cut -d: -f1,7 /etc/passwd
Answer:
DExplanation:
The cut command is used to extract sections from each line of a file or input stream. The -d option specifies the delimiter that separates the fields in each line. The -f option specifies the fields to select. In this case, the delimiter is a colon (:) and the fields are 1 and 7. The first field is the user name and the seventh field is the login shell. Therefore, the cut command with these options will generate a list of user names and their login shells from /etc/passwd. References:
Linux cut Command Explained with 6 Examples
How to Use the Linux cut Command
cut command in Linux with examples
Which of the following commands kills the process with the PID 123 but allows the process to "clean up" before exiting?
Options:
kill -PIPE 123
kill -KILL 123
kill -STOP 123
kill -TERM 123
Answer:
DExplanation:
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
What is the default action of the split command on an input file?
Options:
It will break the file into new files of 1,024 byte pieces each.
It will break the file into new files of 1,000 line pieces each.
It will break the file into new files of 1,024 kilobyte pieces each.
It will break the file into new files that are no more than 5% of the size of the original file.
Answer:
BExplanation:
The split command in Linux is used to split large files into smaller files. The default action of the split command on an input file is to break the file into new files of 1,000 line pieces each. The names of the new files are PREFIXaa, PREFIXab, PREFIXac, and so on. By default, the PREFIX of the new files is x, but it can be changed with the -a option. For example, the following command will split the file someLogFile.log into new files of 1,000 lines each with the prefix log:
split someLogFile.log -a 3 log
The new files will be named logaaa, logaab, logaac, and so on. To verify the number of lines in each new file, we can use the wc command with the -l option. For example, the following command will show the number of lines in the first and the last new file:
wc -l logaaa logaas
The output will be:
1000 logaaa 170 logaas
This means that the original file had 17,170 lines and was split into 18 new files. 17 of them have 1,000 lines each, and the last one has the remaining 170 lines. 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 split and cat to split or join files.
[Split Command in Linux: 9 Useful Examples], Topic: Split Files
In Bash, inserting 1>&2 after a command redirects
Options:
standard error to standard input.
standard input to standard error.
standard output to standard error.
standard error to standard output.
standard output to standard input.
Answer:
CExplanation:
In Bash, inserting 1>&2 after a command redirects standard output to standard error. This means that the output of the command that normally goes to the standard output stream (file descriptor 1) will be sent to the standard error stream (file descriptor 2) instead. This can be useful if we want to capture or discard both the normal output and the error output of a command. For example, if we want to run a command and send both its output and error to /dev/null (a special device that discards any data written to it), we can use:
command > /dev/null 1>&2
This will redirect the standard output of command to /dev/null, and then redirect the standard error of command to the same place as the standard output, which is /dev/null. The other options are not correct because:
A. standard error to standard input: This is not possible, because standard input is a read-only stream, and we cannot redirect output to it.
B. standard input to standard error: This is not what 1>&2 does, because 1 refers to standard output, not standard input. To redirect standard input to standard error, we would need to use 0>&2, where 0 refers to standard input.
D. standard error to standard output: This is not what 1>&2 does, because it would require the opposite order of file descriptors: 2>&1. This would redirect standard error to standard output, not the other way around.
E. standard output to standard input: This is not possible, for the same reason as option A. References:
Bash redirections cheat sheet
How to redirect stderr to a file - Linuxize
In the vi editor, which of the following commands will copy the current line into the vi buffer?
Options:
c
cc
1c
yy
1y
Answer:
DExplanation:
The command that will copy the current line into the vi buffer is yy. The yy command is a shorthand for yank yank, which means to yank (copy) the current line. The vi buffer is a temporary storage area where the copied text is stored until it is pasted somewhere else. The yy command can also be preceded by a number to indicate how many lines to copy. For example, the command 3yy will copy the current line and the next two lines into the buffer.
The other commands are incorrect for the following reasons:
A. c: This command is a shorthand for change, which means to delete the text specified by the following motion and enter insert mode. For example, the command cw will delete the current word and allow the user to type a new one.
B. cc: This command is a shorthand for change change, which means to delete the current line and enter insert mode. This command is similar to dd followed by i, but it is faster and more convenient.
C. 1c: This command is not valid, as it is missing a motion after the change command. The motion specifies what text to delete and replace. For example, the command 1cw will delete one word and enter insert mode.
E. 1y: This command is also not valid, as it is missing a motion after the yank command. The motion specifies what text to copy into the buffer. For example, the command 1yw will copy one word into the buffer.
What is the purpose of the Bash built-in export command?
Options:
It allows disks to be mounted remotely.
It runs a command as a process in a subshell.
It makes the command history available to subshells.
It sets up environment variables for applications.
It shares NFS partitions for use by other systems on the network.
Answer:
DExplanation:
The export command is a Bash built-in command that exports environment variables and functions for use in other shell sessions1. Environment variables are named values that affect the behavior of applications and processes2. For example, the PATH variable stores a list of directories where executable programs are located, and the LANG variable sets the language and locale of the system2. By using the export command, you can make these variables available to any child process spawned by the current shell1. For example, if you want to set the EDITOR variable to vim for all subshells, you can run:
export EDITOR=vim
The export command can also be used to export functions, which are blocks of code that can be reused by invoking their name3. For example, if you want to create and export a function that prints “Hello world”, you can run:
hello () { echo “Hello world”; } export -f hello
Then, you can call the hello function in any subshell or script that inherits the environment from the current shell.
The other options are not related to the export command. Option A refers to the mount command, which attaches a filesystem to a directory4. Option B refers to the command substitution feature, which runs a command in a subshell and replaces it with its output5. Option C refers to the history command, which displays the command history of the current shell. Option E refers to the exportfs command, which maintains the table of exported NFS shares.
From a Bash shell, which of the following commands directly executes the instruction from the file /usr/local/bin/runme.sh without starting a subshell? (Please select TWO answers.)
Options:
source /usr/local/bin/runme.sh
. /usr/local/bin/runme.sh
/bin/bash /usr/local/bin/runme.sh
/usr/local/bin/runme.sh
run /usr/local/bin/runme.sh
Answer:
A, BExplanation:
The commands that directly execute the instruction from the file /usr/local/bin/runme.sh without starting a subshell are source /usr/local/bin/runme.sh and . /usr/local/bin/runme.sh. These commands use the source or dot builtins, which read and execute commands from the given file in the current shell environment. This means that any changes made by the file, such as setting variables, defining functions, or changing directories, will affect the current shell. This is different from running the file as a script, which will create a new shell process and execute the commands in a separate environment. The source or dot commands are useful for loading configuration files, such as ~/.bashrc or /etc/profile, or for running scripts that modify the current state of the shell.
The other commands are incorrect for the following reasons:
C. /bin/bash /usr/local/bin/runme.sh: This command will run the file as a script using the /bin/bash interpreter. This will create a new shell process and execute the commands in a separate environment. Any changes made by the file will not affect the current shell.
D. /usr/local/bin/runme.sh: This command will also run the file as a script, but using the interpreter specified by the shebang line (#!) at the beginning of the file. If the file does not have a shebang line, it will use the default shell interpreter, which may or may not be /bin/bash. This will also create a new shell process and execute the commands in a separate environment. Any changes made by the file will not affect the current shell.
E. run /usr/local/bin/runme.sh: This command is not valid, as there is no builtin or external command called run. This will produce an error message.
Which of the following commands can be used to locate programs and their corresponding man pages and configuration files?
Options:
dirname
which
basename
query
whereis
Answer:
EExplanation:
The correct command to locate programs and their corresponding man pages and configuration files is whereis. The whereis command searches for the binary, source, and manual files for a given command name in a list of standard Linux directories. It can also accept a list of directories to search in by using the -B, -M, or -S options. The whereis command is useful for finding the location and documentation of a program. The other commands are not suitable for this task. The dirname command strips the last component from a file name and returns the directory name. The which command shows the full path of a command that is in the $PATH variable. The basename command strips the directory and suffix from a file name and returns the base name. The query command is not a standard Linux command. References:
[LPI Linux Essentials - 1.1 The Linux Community and a Career in Open Source]
[LPI Linux Essentials - 1.2 Finding Your Way on a Linux System]
[LPI Linux Essentials - 1.4 Finding Files]
whereis command in Linux with Examples - GeeksforGeeks
Whereis Command in Linux | Linuxize
Linux whereis Command Explained for Beginners (5 Examples) - HowtoForge
whereis command | Linux# - Geek University
whereis command in Linux - LinuxForDevices
The system configuration file named _______ is commonly used to set the default runlevel. (Please provide the file name with full path information)
Options:
Answer:
/etc/inittab
Explanation:
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 statements is correct for a command line ending with a & character?
Options:
The command’s output is redirected to/dev/null.
The result of the command defines if the next command will be run.
Thecommand is run in background of the current shell.
The command is run as a direct child of theinitprocess.
Answer:
CExplanation:
The statement that is correct for a command line ending with a & character is that the command is run in background of the current shell. The & character tells the shell to run the command in the background, which means that the shell does not wait for the command to finish and returns the prompt immediately. The command’s output is not redirected to /dev/null, unless explicitly specified. The result of the command does not define if the next command will be run, unless the commands are separated by a logical operator such as && or ||. The command is not run as a direct child of the init process, unless the shell is the init process itself. References: [LPI Exam 101 Detailed Objectives], Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.1: Work on the command line, Background Processes
Which of the following are modes of the vi editor? (Choose two.)
Options:
edit mode
insert mode
change mode
review mode
command mode
Answer:
B, EExplanation:
The modes of the vi editor that are correct are insert mode and command mode. The vi editor is a modal editor, which means that it has different modes for different operations. The insert mode allows the user to insert text into the file. The command mode allows the user to execute commands, such as saving, quitting, moving the cursor, searching, replacing, and so on. The user can switch between the modes by pressing certain keys, such as Esc, i, a, o, and others. The edit mode, change mode, and review mode are not valid modes of the vi editor. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.8: Use vi to create and edit files, vi editor
Which command is used to create and initialize the files used to store quota information? (Specify ONLY the command without any path or parameters.)
Options:
Answer:
quotacheck
Explanation:
The command that is used to create and initialize the files used to store quota information is quotacheck. This command scans one or more file systems for disk usage, creates, checks, and repairs quota files. The quota files are named aquota.user and aquota.group and are located in the root of the file system. The quotacheck command should be run before using quotaon to enable disk quotas.
Which of the following commands is used to change metadata and options for ext3 filesystems?
Options:
mod3fs
tune3fs
mod2fs
tune2fs
dump2fs
Answer:
DExplanation:
The tune2fs command is used to change metadata and options for ext2, ext3, and ext4 filesystems. The tune2fs command can adjust various parameters such as the maximum mount count, the check interval, the reserved blocks percentage, the volume label, and the UUID. The tune2fs command can also enable or disable some filesystem features, such as the journal, the dir_index, the acl, and the user_xattr. The tune2fs command requires the device name or the UUID of the filesystem as an argument, and one or more options to specify the changes to be made. For example, to change the volume label of an ext3 filesystem on /dev/sda1 to “data”, use the following command:
tune2fs -L data /dev/sda1
The other options are not valid commands or options. The mod3fs and mod2fs commands do not exist on a standard Linux system. The tune3fs command is a synonym for tune2fs, but it is not commonly used. The dump2fs command is used to display the superblock and blocks group information for ext2, ext3, and ext4 filesystems, but it does not change any parameters or options. References:
tune2fs - adjust tunable filesystem parameters on ext2/ext3/ext4 …
Chapter 5. The Ext3 File System - Red Hat Customer Portal
Chapter 37. Getting started with an ext3 file system - Red Hat Customer …
Pressing the Ctrl-C combination on the keyboard while a command is executing in the foreground sends which of the following signal codes?
Options:
1(SIGHUP)
2(SIGINT)
3(SIGQUIT)
9(SIGKILL)
15(SIGTERM)
Answer:
CExplanation:
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 of the following settings for umask ensures that new files have the default permissions -rw-r----- ?
Options:
0017
0640
0038
0027
Answer:
DExplanation:
The correct setting for umask that ensures that new files have the default permissions -rw-r----- is 0027. The umask command sets or displays the file mode creation mask, which determines the permissions bits for newly created files or directories. 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 -rw-r-----, which means read and write for the owner and read for the group, we need to subtract 640 from 666, which gives us 026. However, since the first digit of the umask value is for the special permissions, such as setuid, setgid, and sticky bit, we need to add a zero at the beginning to indicate that no special permissions are set. Therefore, the final umask value is 0026. The other options are incorrect because they do not produce the desired permissions. Option A gives the permissions -rw-rw----, which means read and write for the owner and the group. Option B is not a valid umask value, but the desired permissions in octal format. Option C gives the permissions -rw----r–, which means read and write for the owner and read for others. References:
[LPI Linux Essentials - 1.3 Basic File Management]
[LPI Linux Essentials - 2.1 Using Devices, Linux Filesystems, Filesystem Hierarchy Standard]
[LPI Linux Essentials - 2.2 Mounting, Unmounting Filesystems]
[LPI Linux Essentials - 2.3 Disk Partitions]
Umask command in Linux with examples - GeeksforGeeks
Umask Command in Linux | Linuxize
Linux umask Command Explained - LinuxOPsys
Shell Scripting - Umask Command - GeeksforGeeks
umask Command - IBM
After successfully creating a hard link called bar to the ordinary file foo, foo is deleted from the filesystem. Which of the following describes the resulting situation?
Options:
foo and bar would both be removed.
foo would be removed while bar would remain accessible.
foo would be removed. bar would still exist but would be unusable.
Both foo and bar would remain accessible.
The user is prompted whether bar should be removed, too.
Answer:
BExplanation:
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. Therefore, when a hard link is created, the inode reference count is increased by one, and when a hard link is deleted, the inode reference count is decreased by one. The file content is only removed from the disk when the inode reference count reaches zero, meaning that there are no more hard links to the file. In this scenario, after successfully creating a hard link called bar to the ordinary file foo, foo and bar both refer to the same inode and the same file content. The inode reference count is two. When foo is deleted from the filesystem, the inode reference count is decreased by one, but it is still one, meaning that there is still one hard link to the file. Therefore, foo would be removed while bar would remain accessible. The file content would not be removed from the disk until bar is also deleted. The other options are either incorrect or not applicable. The user is not prompted whether bar should be removed, too. The bar link would still exist and be usable, not unusable. 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 are filesystems which can be used on Linux root partitions? (Choose two.)
Options:
NTFS
ext3
XFS
VFAT
swap
Answer:
B, CExplanation:
The Linux root partition is the partition that contains the root filesystem, which is the top-level directory of the filesystem hierarchy. The root filesystem contains the essential files and directories that are needed to boot the system, such as the kernel, the init system, the configuration files, the libraries, the binaries, and the device files. The root partition can be formatted with different filesystems, depending on the support of the kernel and the boot loader. Some of the common filesystems that can be used on Linux root partitions are:
ext3: This is the third extended filesystem, which is a journaling filesystem that provides metadata and data integrity, fast recovery, and backward compatibility with ext2. ext3 is widely supported by most Linux distributions and boot loaders, and it is considered stable and reliable. ext3 has been the default filesystem for many Linux distributions, such as Debian, Ubuntu, Fedora, and CentOS, until it was replaced by ext4.
XFS: This is a high-performance 64-bit journaling filesystem that supports large files and volumes, parallel I/O, extent-based allocation, and online defragmentation. XFS is designed for scalability and efficiency, and it is suitable for applications that handle large amounts of data, such as databases, video editing, and data warehousing. XFS is the default filesystem for Red Hat Enterprise Linux and SUSE Linux Enterprise Server, and it is also supported by other Linux distributions and boot loaders.
The other options are not valid filesystems for Linux root partitions, because:
NTFS: This is the New Technology File System, which is the default filesystem for Windows operating systems. NTFS supports features such as journaling, encryption, compression, and access control. NTFS is not natively supported by the Linux kernel, and it requires a third-party driver, such as ntfs-3g, to read and write to NTFS partitions. NTFS is not compatible with the Linux boot loader, and it cannot be used as the root filesystem for Linux.
VFAT: This is the Virtual File Allocation Table, which is an extension of the FAT32 filesystem that supports long file names. VFAT is a legacy filesystem that is mainly used for compatibility with older Windows and DOS systems. VFAT does not support features such as journaling, permissions, and symbolic links, and it has limitations on the file and volume size. VFAT is not suitable for the root filesystem for Linux, and it is not supported by the Linux boot loader.
swap: This is not a filesystem, but a special type of partition that is used to store the memory pages that are not currently in use by the system. swap is used to extend the physical memory of the system, and it can improve the performance and stability of the system. swap is not a mountable partition, and it cannot be used as the root filesystem for Linux.
Which of the following commands is used to modify quota settings? (Choose two.)
Options:
editquota
setquota
edquota
quotaedit
quotaset
Answer:
B, CExplanation:
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.
What does the command mount -a do?
Options:
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.
Answer:
DExplanation:
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 command shows all shared libraries required by a binary executable or another shared library? (Specify ONLY the command without any path or parameters.)
Options:
Answer:
ldd
Explanation:
The command that shows all shared libraries required by a binary executable or another shared library is ldd. This command queries the dynamic linker to find out which libraries are needed by the given file and displays them on the standard output. For example, to see the shared libraries required by the /bin/ls program, we can run:
ldd /bin/ls
The output will look something like this:
linux-vdso.so.1 (0x00007ffd8a7f6000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f0c5a6c4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0c5a4d3000)
libpcre2-8.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f0c5a445000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0c5a441000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0c5a8a5000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0c5a41e000)
The output shows the name and the path of each shared library, as well as the address where it is loaded in memory. If the library is not found, the output will show not found instead of the path. The linux-vdso.so.1 library is a special case, as it is a virtual library that is not actually present on the filesystem, but is injected by the kernel into every process12.
Which of the following apt-get commands will install the newest versions of all currently installed packages?
Options:
auto-update
full-upgrade
dist-upgrade
install
update
Answer:
BExplanation:
The apt-get command is used to interact with the APT package management system on Debian-based Linux distributions. The apt-get command has several subcommands that perform different operations on packages. One of these subcommands is full-upgrade, which is used to install the newest versions of all currently installed packages, along with their dependencies. The full-upgrade command also removes any packages that are no longer needed or that conflict with the upgraded packages. The full-upgrade command is equivalent to the dist-upgrade command, which is an older name for the same operation. The other options are not valid subcommands of apt-get. The auto-update option does not exist, the install option is used to install specific packages, not to upgrade them, the update option is used to update the list of available packages, not to install them, and the dist-upgrade option is the same as the full-upgrade option. References:
APT-GET Command in Linux {Detailed Tutorial With Examples} - phoenixNAP
Using apt-get Commands in Linux [Ultimate Guide] - It’s FOSS
Ubuntu ‘apt-get’ list of commands (list, update, upgrade, cheatsheet …
Which of the following commands shows the definition of a given shell command?
Options:
where
stat
type
case
Answer:
CExplanation:
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
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.)
Options:
Answer:
0077, 077
Explanation:
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 commands can be used to create a new file that is 100kB in size?
Options:
dd
file
mkfile
touch
Answer:
AExplanation:
The dd command can be used to create a new file that is 100kB in size. The dd command copies data from one source to another, using specified input and output block sizes. To create a new file that is 100kB in size, the dd command can use /dev/zero as the input source, which provides an endless stream of zeros, and specify the output file name, the output block size (bs) and the count of blocks to copy. For example, dd if=/dev/zero of=file.txt bs=1k count=100 will create a file named file.txt that is 100kB in size. The file command can be used to determine the type of a file. The mkfile command is not a valid Linux command. The touch command can be used to create a new empty file or update the access and modification times of an existing file, but it does not specify the size of the file. References: [LPI Exam 101 Detailed Objectives], Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.3: Perform basic file management, dd command, file command, touch command
Which of the following describes the correct order in which the components of the system boot process are started?
Options:
BIOS, kernel, bootloader, init system
BIOS, bootloader,kernel, init system
Bootloader, BIOS, kernel, init system
BIOS, bootloader, init system, kernel
Bootloader, BIOS, init system, kernel
Answer:
BExplanation:
The system boot process is the sequence of steps that the system follows when it is powered on or restarted. The system boot process can be divided into four main components: BIOS, bootloader, kernel, and init system. The order in which these components are started is:
BIOS: BIOS stands for Basic Input/Output System, and it is the first component that runs when the system is powered on. BIOS is a firmware program that is stored in a ROM chip on the motherboard, and it performs some basic tasks, such as:
initializing the hardware components and peripherals
performing the power-on self-test (POST) to check the system integrity
selecting a boot device from the boot order list
loading and executing the bootloader program from the boot device
Bootloader: Bootloader is a small program that is responsible for loading and executing the kernel. Bootloader is usually stored in the first sector of the boot device, which can be a hard disk, a USB drive, or a CD-ROM. Bootloader can also display a menu that allows the user to choose from different kernel images or operating systems. Some common bootloaders for Linux systems are GRUB, LILO, and SYSLINUX.
Kernel: Kernel is the core of the operating system, and it manages the system resources, controls the hardware devices, and provides basic services to other programs. Kernel is a large binary file that is compressed and stored in the boot device, usually in the /boot directory. Kernel is loaded into memory and executed by the bootloader, and it performs some tasks, such as:
decompressing itself and relocating to a higher memory address
detecting and initializing the hardware devices and drivers
mounting the root filesystem and creating a temporary filesystem in RAM
starting the init system, which is the first user-space program
Init system: Init system is the program that initializes the user-space environment and spawns all other processes. Init system is always the first process that runs on the system, and it has the process ID (PID) of 1. Init system can also perform some tasks, such as:
reading the configuration files and scripts that define the system services and runlevels
starting and stopping the system services and daemons
managing the system logins and terminals
running a graphical user interface or a command-line interface
Some common init systems for Linux systems are SysVinit, systemd, and Upstart.
Which run levels should never be declared as the default run level when using SysV init? (Choose TWO correct answers.)
Options:
0
1
3
5
6
Answer:
A, EExplanation:
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
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?
Options:
Answer:
proc/interrupts
Explanation:
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 of the following options for the kernel's command line changes the systemd boot target to rescue.target instead of the default target?
Options:
systemd.target=rescue.target
systemd.runlevel=rescue.target
systemd.service=rescue.target
systemd.default=rescue.target
systemd.unit=rescue.target
Answer:
EThe USB device filesystem can be found under /proc/______/usb/. (Please fill in the blank with the single word only)
Options:
Answer:
bus
Explanation:
The USB device filesystem can be found under /proc/bus/usb/1. This is a virtual filesystem that provides information about the USB devices and buses connected to the system12. It contains files and directories that correspond to the USB host controllers, hubs, and devices12. For example, the following output shows the contents of /proc/bus/usb/ on a system with one USB host controller and two USB devices:
The directories 001 and 002 represent the USB buses, and each contain files that represent the USB devices on that bus. The file devices contains a summary of all the USB devices and their configurations. The file drivers contains a list of the USB drivers and the devices they are bound to12.
The /proc/bus/usb/ filesystem is deprecated and should not be used anymore3. It has been replaced by the /sys/bus/usb/ filesystem, which is a sysfs mount that provides more detailed and structured information about the USB devices and buses3 .
Which of the following are init systems used within Linux systems? (Choose THREE correct answers.)
Options:
startd
systemd
Upstart
SysInit
SysV init
Answer:
B, C, EExplanation:
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 of the following kernel parameters instructs the kernel to suppress most boot messages?
Options:
silent
verbose=0
nomesg
quiet
Answer:
DExplanation:
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.
What of the following statements are true regarding /dev/ when using udev? (Choose TWO correct answers.)
Options:
Entries for all possible devices get created on boot even if those devices are not connected.
Additional rules for udev can be created by adding them to /etc/udev/rules.d/.
When using udev, it is not possible to create block orcharacter devices in /dev/ using mknod.
The /dev/ directory is a filesystem of type tmpfs and is mounted by udev during system startup.
The content of /dev/ is stored in /etc/udev/dev and is restored during system startup.
Answer:
B, DExplanation:
udev is a device manager that dynamically creates and removes device nodes in the /dev/ directory. It also handles device events, such as adding, removing, or changing the attributes of devices. udev uses rules to match devices and assign properties, permissions, names, symlinks, and other actions. The rules are stored in files under /lib/udev/rules.d/ and /etc/udev/rules.d/. The latter directory can be used to create additional or override existing rules. The /dev/ directory is not a regular directory on the root filesystem, but a virtual filesystem of type tmpfs that is mounted by udev during system startup. tmpfs is a filesystem that resides in memory and can grow and shrink dynamically. The content of /dev/ is not stored in /etc/udev/dev, but is created by udev based on the rules and the available devices. udev does not prevent the creation of block or character devices in /dev/ using mknod, but it may overwrite or remove them if they conflict with the rules or the device events. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 102.4
Which SysV init configuration file should be modified to disable the ctrl-alt-delete key combination?
Options:
/etc/keys
/proc/keys
/etc/inittab
/proc/inittab
/etc/reboot
Answer:
CExplanation:
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
What information can the lspci command display about the system hardware? (Choose THREE correct answers.)
Options:
Device IRQ settings
PCI bus speed
System battery type
Device vendor identification
Ethernet MAC address
Answer:
A, B, DExplanation:
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.
The message "Hard Disk Error" is displayed on the screen during Stage 1 of the GRUB boot process. What does this indicate?
Options:
The kernel was unable to execute /bin/init
The next Stage cannot be read from the hard disk because GRUB was unable to determine the size and geometry of the disk
One or more of the filesystems on the hard disk has errors and a filesystem check should be run
The BIOS was unable to read the necessary data from the Master Boot Record to begin the boot process
Answer:
BExplanation:
The GRUB boot process consists of three stages1:
Stage 1: This stage is located in the Master Boot Record (MBR) of the first hard disk or the boot sector of a partition. Its main function is to load either Stage 1.5 or Stage 22.
Stage 1.5: This stage is located in the first 30 KB of hard disk immediately following the MBR or in the boot sector of a partition. It contains the code to access the file system that contains the GRUB configuration file. Its main function is to load Stage 22.
Stage 2: This stage is located in an ordinary file system, usually in the /boot/grub directory. It contains the code to display the GRUB menu and to load the kernel and initrd images. It can also load additional modules to support other file systems or features2.
The message “Hard Disk Error” is displayed on the screen during Stage 1 of the GRUB boot process. This indicates that the next Stage (either Stage 1.5 or Stage 2) cannot be read from the hard disk because GRUB was unable to determine the size and geometry of the disk3. This could occur because the BIOS translated geometry has been changed by the user or the disk is moved to another machine or controller after installation, or GRUB was not installed using itself (if it was, the Stage 2 version of this error would have been seen during that process and it would not have completed the install)3.
The other options in the question are not correct because:
A. The kernel was unable to execute /bin/init: This error would occur in Stage 2, after the kernel and initrd images are loaded, not in Stage 14.
C. One or more of the filesystems on the hard disk has errors and a filesystem check should be run: This error would also occur in Stage 2, when GRUB tries to access the file system that contains the GRUB configuration file, not in Stage 15.
D. The BIOS was unable to read the necessary data from the Master Boot Record to begin the boot process: This error would prevent GRUB from starting at all, not in Stage 16.
Which command will display messages from the kernel that were output during the normal boot sequence?
Options:
Answer:
dmesg
Explanation:
The command dmesg will display messages from the kernel that were output during the normal boot sequence. The dmesg command reads the kernel ring buffer, which is a data structure that stores the most recent messages generated by the kernel. The dmesg command can also be used to display messages from the kernel that were output after the boot sequence, such as hardware events, driver messages, or system errors. The dmesg command has various options to filter, format, or save the output. For example, dmesg -T will display human-readable timestamps for each message, and dmesg -w will display the messages in real time as they occur. References:
1: How to view all boot messages in Linux after booting? - Super User
2: dmesg(1) - Linux manual page
3: Kernel ring buffer - Wikipedia
During a system boot cycle, what program is executed after the BIOS completes its tasks?
Options:
The bootloader
The inetd program
The init program
The kernel
Answer:
AExplanation:
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
Which file in the /proc filesystem lists parameters passed from the bootloader to the kernel? (Specify the file name only without any path.)
Options:
Answer:
cmdline
Explanation:
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.)
Options:
Boot device order
Linux kernel version
Timezone
Hardware configuration
The system's hostname
Answer:
A, DExplanation:
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 statements is correct when talking about /proc/?
Options:
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.
Answer:
CExplanation:
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 commands reboots the system when using SysV init? (Choose TWO correct answers.)
Options:
shutdown -r now
shutdown -r "rebooting"
telinit 6
telinit 0
shutdown -k now "rebooting"
Answer:
A, CExplanation:
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
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)
Options:
Answer:
dmesg,
Explanation:
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
During a system boot cycle, what is the program that is run after the BIOS completes its tasks?
Options:
The bootloader
The inetd program
The init program
The kernel
Answer:
AExplanation:
The program that is run after the BIOS completes its tasks is the bootloader12. The bootloader is a small program that loads the operating system into memory and executes it. The bootloader can be located in the Master Boot Record (MBR) of the first hard disk or the boot sector of a partition for BIOS systems, or in an .efi file on the EFI System Partition for UEFI systems12. The bootloader can also display a menu to allow the user to choose from different operating systems or kernel versions to boot12.
The other options in the question are not correct because:
B. The inetd program: This is a program that listens for incoming network connections and launches the appropriate service for them. It is not involved in the boot process3.
C. The init program: This is a program that is executed by the kernel as the first user-space process. It is responsible for starting and managing other processes and services. It is not run by the BIOS.
D. The kernel: This is the core of the operating system that controls everything in the system. It is loaded and executed by the bootloader, not by the BIOS.
In which directory must definition files be placed to add additional repositories to yum?
/etc/yum.repos.d
/etc/yum.repos.d/
yum.repos.d
yum.repos.d/
Options:
Answer:
B
Explanation:
The /etc/yum.repos.d/ directory contains configuration files for additional yum repositories. Each file in this directory should end with .repo and contain information about one or more repositories. The yum command will read all the files in this directory and use them as sources for software packages. The format of the .repo files is similar to the /etc/yum.conf file, which contains the main configuration options for yum. Each .repo file can have one or more sections, each starting with [repository] where repository is a unique identifier for the repository. The section can have various options, such as name, baseurl, enabled, gpgcheck, etc. For example, a .repo file for the EPEL repository could look like this:
[epel] name=Extra Packages for Enterprise Linux 7 - $basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
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.)
Options:
Timestamps
MD5 checksums
Inodes
File sizes
GnuPG signatures
Answer:
A, B, DExplanation:
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.
To what environment variable will you assign or append a value if you need to tell the dynamic linker to look in a build directory for some of a program's shared libraries?
Options:
LD_LOAD_PATH
LD_LIB_PATH
LD_LIBRARY_PATH
LD_SHARE_PATH
LD_RUN_PATH
Answer:
CExplanation:
The environment variable LD_LIBRARY_PATH is used to tell the dynamic linker to look in a specific directory for some of a program’s shared libraries. It is a colon-separated list of directories that are searched by the dynamic linker when looking for a shared library to load1. The directories are searched in the order they are mentioned in. For example, if we have a program that depends on a shared library libfoo.so that is located in /home/user/build/lib, we can run the program with:
LD_LIBRARY_PATH=/home/user/build/lib ./program
This will instruct the dynamic linker to search for libfoo.so in /home/user/build/lib before the default directories. The environment variable LD_LIBRARY_PATH can also be appended to an existing value with the += operator, for example:
LD_LIBRARY_PATH+=:/home/user/build/lib
This will add /home/user/build/lib to the end of the LD_LIBRARY_PATH list. The other options are not valid environment variables for the dynamic linker. LD_LOAD_PATH, LD_LIB_PATH, and LD_SHARE_PATH are not recognized by the dynamic linker. LD_RUN_PATH is a linker option that can be used to embed a library search path in the executable at link time, but it is not an environment variable that can be set or modified at run time2. References:
LPI Exam 101 Detailed Objectives, section 1.101.3
ld-linux(8) — Linux manual page
Setting the dynamic linker with an environment variable - narkive
Which of the following is correct when talking about mount points?
Options:
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.
Answer:
AExplanation:
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.
The dpkg-____ command will ask configuration questions for a specified package, just as if the package were being installed for the first time.
Options:
Answer:
dpkg-reconfigure
Explanation:
The dpkg-reconfigure command is used to reconfigure an already installed package. It asks configuration questions for the package, just as if the package were being installed for the first time. This can be useful if the user wants to change some settings or options for the package without reinstalling it. The dpkg-reconfigure command can also be used to fix a broken package configuration or to restore the default settings. References:
dpkg-reconfigure(8) - Linux man page
Linux Professional Institute: Exam 101 Objectives
What is the difference between the --remove and the --purge action with the dpkg command?
Options:
--remove removes the program, --purge also removes the config files
--remove only removes the program, --purge only removes the config files
--remove removes a package, --purge also removes all packages dependent on it
--remove removes only the package file itself, --purge removes all files related to the package
Answer:
AExplanation:
The dpkg command is a tool to install, build, remove and manage Debian packages. The option --remove is used to remove an installed package, but it does not remove the configuration files that may have been modified by the user. The option --purge is used to remove an installed package and also delete its configuration files. This can be useful if the user wants to completely uninstall a package and start from scratch if it is reinstalled later. The syntax is: dpkg --remove package or dpkg --purge package. For example, dpkg --remove nginx will remove the nginx web server package, but it will leave the configuration files in /etc/nginxdpkg --purge nginx will remove the nginx package and also delete the configuration files in /etc/nginx1. The other options are not correct because:
–remove only removes the program, --purge only removes the config files: This is false, because --purge also removes the program, not just the config files.
–remove removes a package, --purge also removes all packages dependent on it: This is false, because --purge does not remove any other packages, only the specified one. To remove a package and its dependencies, the apt-get command can be used with the option --auto-remove2.
–remove removes only the package file itself, --purge removes all files related to the package: This is false, because --remove also removes the files that are installed by the package, not just the package file itself. --purge only removes the configuration files that are not removed by --remove. References:
dpkg(1) — dpkg — Debian buster — Debian Manpages
How to remove a package and its dependencies with dpkg? - Ask Ubuntu
Which of the following commands lists the dependencies of a given dpkg package?
Options:
apt-cache depends-onpackage
apt-cache dependencies package
apt-cache depends package
apt-cache requires package
Answer:
CExplanation:
The apt-cache command is used to query the APT cache for information about packages. The depends option shows a listing of each dependency a package has and all the possible other packages that can fulfill that dependency. For example, apt-cache depends ubuntu-restricted-extras will show the dependencies of the ubuntu-restricted-extras package. The other options are not valid for the apt-cache command. References:
How to Check Dependencies of a Package in Ubuntu/Debian-based Linux Distributions
Check DEB package dependencies on Ubuntu / Debian
Which of the following commands is used to update the list of available packages when using dpkg based package management?
Options:
apt-get update
apt-get upgrade
apt-cache update
apt-get refresh
apt-cache upgrade
Answer:
AExplanation:
The command that is used to update the list of available packages when using dpkg based package management is apt-get update12. The apt-get command is a high-level tool that works with dpkg and provides a user-friendly interface for managing packages3. The apt-get update command is used to synchronize the package index files from the sources specified in the /etc/apt/sources.list file12. This command does not install or upgrade any packages, but only downloads the information about the latest versions and dependencies of the packages12. The apt-get update command is usually run before the apt-get upgrade or apt-get install commands, which are used to upgrade or install packages respectively12.
The other options in the question are not correct because:
B. apt-get upgrade: This command is used to upgrade the installed packages to the latest versions, not to update the list of available packages12.
C. apt-cache update: There is no such command in Linux. The apt-cache command is used to query and display information about the packages, not to update them4.
D. apt-get refresh: There is no such command in Linux. The closest command is apt-get update, which is the correct answer.
E. apt-cache upgrade: There is no such command in Linux. The closest command is apt-get upgrade, which is not the correct answer.
Which file should be edited to select the network locations from which Debian installation package files are loaded?
Options:
/etc/dpkg/dpkg.cfg
/etc/apt/apt.conf
/etc/apt/apt.conf.d
/etc/apt/sources.list
/etc/dpkg/dselect.cfg
Answer:
DExplanation:
The /etc/apt/sources.list file is the main configuration file for the Advanced Package Tool (apt), which is used to manage Debian installation package files. This file contains a list of repositories, or sources, from which apt can download and install packages. Each repository is specified by a line that has the following format:
type uri suite [component1] [component2] […]
Where:
type is the access method, such as http, ftp, file, etc.
uri is the Uniform Resource Identifier (URI) of the repository, such as
suite is the distribution code name or archive name, such as stable, testing, unstable, etc.
component is an optional section of the repository, such as main, contrib, non-free, etc.
For example, a typical sources.list file for Debian stable could look like this:
deb stable main contrib non-free deb-src stable main contrib non-free
deb stable/updates main contrib non-free deb-src stable/updates main contrib non-free
deb stable-updates main contrib non-free deb-src stable-updates main contrib non-free
The first two lines specify the main repository for Debian stable, with both binary (deb) and source (deb-src) packages. The next two lines specify the security updates repository for Debian stable, which contains important security fixes. The last two lines specify the stable-updates repository, which contains packages that have been updated after the release of Debian stable.
By editing the /etc/apt/sources.list file, one can select the network locations from which Debian installation package files are loaded. However, it is recommended to use a graphical or command-line tool, such as aptitude or synaptic, to manage the sources.list file, as they can handle the syntax and avoid errors.
Which Debian package management tool asks the configuration questions for a specific already installed package just as if the package were being installed for the first time? (Specify ONLY the command without any path or parameters.)
Options:
Answer:
dpkg-reconfigure
Explanation:
The command dpkg-reconfigure is a Debian package management tool that asks the configuration questions for a specific already installed package just as if the package were being installed for the first time. It can be used to reconfigure a package that was previously installed with default settings, or to change the settings of a package that requires user input during installation. It can also be used to fix a broken configuration file or to restore the original configuration file of a package. References:
Debian Reference: Chapter 2. Debian package management
LPI Linux Essentials: 1.3 Package Management
After modifying GNU GRUB's configuration file, which command must be run for the changes to take effect?
Options:
kill -HUP $(pidof grub)
grub-install
grub
No action is required
Answer:
BExplanation:
After modifying GNU GRUB’s configuration file, which is usually located at /etc/default/grub, the command that must be run for the changes to take effect is grub-install12. The grub-install command is used to install GRUB on a device or partition, and to update the boot sector and the core image of GRUB3. The command takes the following basic syntax:
$ grub-install [options] install_device
The install_device argument specifies the device or partition where GRUB should be installed, such as /dev/sda or /dev/sda1. The options can be used to control various aspects of the installation, such as the target platform, the boot directory, the force mode, the verbosity level, etc3.
The grub-install command also invokes the grub-mkconfig command, which generates the GRUB configuration file (usually located at /boot/grub/grub.cfg) based on the settings in /etc/default/grub and the scripts in /etc/grub.d4. The grub-mkconfig command can also be run separately to update the GRUB configuration file without reinstalling GRUB on the device or partition4.
The other options in the question are not correct because:
A. kill -HUP $(pidof grub): This command would send the hangup signal (HUP) to the process ID (PID) of grub, which is a command-line interface for GRUB. This would not update the GRUB configuration file or install GRUB on the device or partition.
C. grub: This command would run the command-line interface for GRUB, which allows the user to interact with GRUB and execute various commands. This would not update the GRUB configuration file or install GRUB on the device or partition, unless the user explicitly runs the appropriate commands within the interface.
D. No action is required: This option is false, because modifying the /etc/default/grub file alone does not affect the GRUB configuration file or the GRUB installation. The user needs to run either grub-install or grub-mkconfig to apply the changes.
Which of the following environment variables overrides or extends the list of directories holding shared libraries?
Options:
LD_LOAD_PATH
LD_LIB_PATH
LD_LIBRARY_PATH
LD_SHARE_PATH
LD_RUN_PATH
Answer:
CExplanation:
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 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?
Options:
hidemenu
splash
timeout
showmenu
Answer:
CExplanation:
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 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.)
Options:
Answer:
/tmp
Answer:tmp,
Answer:/var/tmp/
Answer:/var/tmp/
Answer:A
Explanation:
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.
Which function key is used to start Safe Mode in Windows NT?
Options:
F10
F8
F6
Windows NT does not support Safe Mode
Answer:
DExplanation:
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 apt-get commands will install the newest versions of all currently installed packages without removing any packages or installing new packages that are not already installed?
Options:
auto-update
upgrade
dist-upgrade
install
update
Answer:
BExplanation:
The apt-get command upgrade will install the newest versions of all currently installed packages without removing any packages or installing new packages that are not already installed. It will only upgrade packages that can be upgraded without changing the dependencies1. The syntax is: apt-get upgrade. For example, apt-get upgrade nginx will update the nginx package to the latest version available in the repositories, if there is one2. The other options are not correct because:
auto-update is not a valid apt-get command.
dist-upgrade will also install new packages or remove existing packages if that is required to resolve a package conflict1. It is more aggressive than upgrade and may change the system in unexpected ways3.
install will install new packages or upgrade existing packages to the specified version1. It may also install or remove dependencies as needed4.
update will only resynchronize the package index files from the sources, but it will not install or upgrade any packages1. References:
apt-get(8) — apt — Debian buster — Debian Manpages
How to Update Nginx on Ubuntu 18.04 | Linuxize
What is “dist-upgrade” and why does it upgrade more than “upgrade”? - Ask Ubuntu
How to Install Specific Version of Package using apt-get - TecAdmin
Which of the following commands lists all currently installed packages when using RPM package management?
Options:
yum --query --all
yum --list --installed
rpm --query --all
rpm --list –installed
Answer:
CExplanation:
The command that lists all currently installed packages when using RPM package management is rpm --query --all. This command displays information about all the packages that are currently installed on the system, including their name, version, release, and architecture1. The output can be customized by using various query options and format specifiers2.
The other commands are either invalid or related to YUM, not RPM. yum --query --all is not a valid YUM command, as YUM does not have a --query option3. yum --list --installed is a valid YUM command, but it lists the packages from the YUM repositories, not the RPM database3. rpm --list --installed is not a valid RPM command, as RPM does not have a --list option2.
What can the Logical Volume Manager (LVM) be used for? (Choose THREE correct answers.)
Options:
To create RAID 9 arrays.
To dynamically change the size of logical volumes.
To encrypt logical volumes.
To create snapshots.
To dynamically create or delete logical volumes.
Answer:
B, D, EExplanation:
The Logical Volume Manager (LVM) is a tool that allows the creation and management of logical volumes on Linux systems. Logical volumes are partitions that can span multiple physical disks and can be resized or deleted without affecting the rest of the system. Some of the benefits of using LVM are:
To dynamically change the size of logical volumes. LVM allows the user to increase or decrease the size of a logical volume without having to repartition the disk or reboot the system. This can be useful for allocating more space to a volume that is running out of space, or freeing up space from a volume that is not needed anymore.
To create snapshots. LVM allows the user to create a snapshot of a logical volume, which is a copy of the volume at a certain point in time. Snapshots can be used for backup purposes, as they can be restored to the original volume if needed. Snapshots can also be used for testing purposes, as they can be mounted as read-only or read-write volumes without affecting the original volume.
To dynamically create or delete logical volumes. LVM allows the user to create or delete logical volumes on the fly, without having to repartition the disk or reboot the system. This can be useful for creating temporary volumes for specific purposes, or deleting volumes that are no longer needed.
LVM cannot be used for the following purposes:
To create RAID 9 arrays. RAID 9 is not a valid RAID level, and LVM does not support RAID functionality. RAID is a technique that uses multiple disks to provide redundancy, performance, or both. RAID can be implemented at the hardware level, by using a RAID controller, or at the software level, by using tools such as mdadm or dmraid. LVM can work on top of RAID devices, but it cannot create them.
To encrypt logical volumes. LVM does not provide encryption functionality. Encryption is a technique that protects data from unauthorized access by using a secret key to transform the data into an unreadable form. Encryption can be implemented at the disk level, by using tools such as dm-crypt or LUKS, or at the file system level, by using tools such as eCryptfs or EncFS. LVM can work on top of encrypted devices, but it cannot encrypt them.
Which of the following apt-get subcommands installs the newest versions of all currently installed packages?
Options:
auto-update
dist-upgrade
full-upgrade
install
update
Answer:
BExplanation:
The apt-get subcommand that installs the newest versions of all currently installed packages is dist-upgrade. The dist-upgrade subcommand performs the same function as the upgrade subcommand, which is to install the latest versions of the packages that are already installed on the system, but it also intelligently handles the dependencies and removes the obsolete packages if necessary. The dist-upgrade subcommand is useful when upgrading the entire system to a new release or distribution12.
The other options are either invalid or do not perform the desired task. The auto-update subcommand does not exist, and the update subcommand only updates the list of available packages from the repositories, but does not install any packages. The full-upgrade subcommand is an alias for the dist-upgrade subcommand, so it performs the same function, but it is not the standard name for the subcommand. The install subcommand installs new packages or specific versions of packages, but it does not upgrade all the currently installed packages. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute2
APT-GET Command in Linux {Detailed Tutorial With Examples} - phoenixNAP3
How do I get help on apt-get’s install subcommand?
APT Cheat Sheet | Packagecloud Blog
Which of the following properties of a Linux system should be changed when a virtual machine is cloned? (Choose two.)
Options:
The partitioning scheme
The file system
The D-Bus Machine ID
The permissions of /root/
The SSH host keys
Answer:
C, EExplanation:
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 character in the password field of /etc/passwd is used to indicate that the encrypted password is stored in /etc/shadow?
Options:
*
-
$
#
x
Answer:
EWhat information is shown by the echo $ ? command?
Options:
The process ID of the echo command
The exit value of the command executed immediately before echo.
The process ID which will be used for the next command
The exit value of the echo command
The process ID of the current shell
Answer:
BA faulty kernel module is causing issues with a network interface card. Which of the following actions ensures that this module is not loaded automatically when the system boots?
Options:
Using lsmod --remove --autoclean without specifying the name of a specific module
Using modinfo –k followed by the name of the offending module
Using modprobe –r followed by the name of the offending module
Adding a blacklist line including the name of the offending module to the file /etc/modprobe.d/blacklist.conf
Deleting the kernel module’s directory from the file system and recompiling the kernel, including its modules
Answer:
DExplanation:
The action that ensures that a faulty kernel module is not loaded automatically when the system boots is adding a blacklist line including the name of the offending module to the file /etc/modprobe.d/blacklist.conf. This file contains a list of kernel modules that are prevented from loading by the modprobe command, which is used to load and unload modules from the running kernel. By adding a line like blacklist
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute2
Linux Kernel Module Management 101 - Linux.com1
Chapter 2. Managing kernel modules - Red Hat Customer Portal2
Which mechanism does ssh use to interact with the SSH agent?
Options:
Connecting to port 2222 which is used by the system-w»de SSH agent
Using the fixed socket .ssh-agenc/ipc.
Creating an alias replacing ssh with calls to ssh-agent
Starting sab-agent as a child process for each ssh invocation
Evaluating environment variables such as ssh_auth_sock.
Answer:
EWhich of the following commands displays the output of the foo command on the screen and also writes it to a file called /tmp/foodata?
Options:
foo | less /tmp/foodata
foo | cp /tmp/foodata
foo > /tmp/foodata
foo | tee /tmp/foodata
foo > stdout >> /tmp/foodata
Answer:
DExplanation:
This command will display the output of the foo command on the screen and also write it to a file called /tmp/foodata. The syntax of the command is:
foo | tee [options] [file]
The foo command is any command that produces some output. The | symbol is a pipe operator that redirects the standard output of one command to the standard input of another command. The tee command reads from the standard input and writes to both the standard output and one or more files. The options can modify the behavior of the tee command, such as appending to the file instead of overwriting it, or ignoring interrupt signals. The file is the name of the file to which the output is written. If no file is given, the tee command will only write to the standard output.
Therefore, the command foo | tee /tmp/foodata will run the foo command, pipe its output to the tee command, which will display the output on the screen and write it to the file /tmp/foodata.
The other commands are incorrect for the following reasons:
A, foo | less /tmp/foodata: This command will not write the output of the foo command to a file, but it will display the output of the foo command on the screen in a pager. The less command is a program that allows the user to view and scroll through a file or the output of a command. The syntax of the command is:
foo | less [options] [file]
The foo command is any command that produces some output. The | symbol is a pipe operator that redirects the standard output of one command to the standard input of another command. The less command reads from the standard input or a file and displays it on the screen in a pager. The options can modify the behavior of the less command, such as setting the number of lines per screen, or searching for a pattern. The file is the name of the file to be viewed. If no file is given, the less command will read from the standard input.
Therefore, the command foo | less /tmp/foodata will run the foo command, pipe its output to the less command, which will display the output on the screen in a pager. However, the /tmp/foodata argument will be ignored by the less command, because it will read from the standard input instead of the file. The command will not write anything to the file /tmp/foodata.
B, foo | cp /tmp/foodata: This command will not work as expected, because it has several errors. First, the cp command is not a valid command to write the output of a command to a file. The cp command is used to copy files or directories from one location to another. The syntax of the command is:
cp [options] source destination
The options can modify the behavior of the cp command, such as preserving the attributes of the files, or creating backups of the existing files. The source is the name of the file or directory to be copied. The destination is the name of the file or directory where the source is copied to.
Second, the pipe operator is not a valid way to redirect the output of a command to the cp command. The pipe operator redirects the standard output of one command to the standard input of another command. However, the cp command does not read from the standard input, but from the source argument. Therefore, the command foo | cp /tmp/foodata will run the foo command, pipe its output to the cp command, which will ignore the standard input and report an error for missing the destination argument. The command will not write anything to the file /tmp/foodata.
C, foo > /tmp/foodata: This command will not display the output of the foo command on the screen, but it will write it to a file called /tmp/foodata. The > symbol is a redirection operator that redirects the standard output of a command to a file or device, overwriting any existing content. The syntax of the command is:
foo > file
The foo command is any command that produces some output. The > symbol redirects the standard output of the foo command to the file. The file is the name of the file to which the output is written.
Therefore, the command foo > /tmp/foodata will run the foo command, redirect its output to the file /tmp/foodata, and overwrite any previous content. The command will not display anything on the screen.
E, foo > stdout >> /tmp/foodata: This command will not work as expected, because it has several errors. First, the stdout argument is not a valid file name or device name. The stdout is an abbreviation for the standard output, which is a stream that a program uses to write its output. However, the stdout is not a file or device that can be used as a destination for the redirection operator. Second, the >> symbol is a redirection operator that redirects the standard output of a command to a file or device, appending to any existing content. The syntax of the command is:
foo >> file
The foo command is any command that produces some output. The >> symbol redirects the standard output of the foo command to the file. The file is the name of the file to which the output is appended.
Therefore, the command foo > stdout >> /tmp/foodata will run the foo command, redirect its output to the stdout argument, which will cause an error, and then redirect its output again to the file /tmp/foodata, which will append the output to the file. The command will not display anything on the screen.
What is true about the following command?
Nmcli device wifi connect WIFIoI
Options:
NetworkManager opens a new public hotspol with the SSID wifioi
NetworkManager creates an unconfigured new virtual network interface named wifioi.
NetworkManager creates a new wifi connection wifioi and activates it
NetworkManager returns an error in case the connection wifioi does not exist
NetworkManager reports an error because wifioi is an invalid wifi device
Answer:
CWhat output will be displayed when the user fred executes the following command?
echo ‘fred $USER’
Options:
fred fred
fred /home/fred/
‘fred $USER’
fred $USER
‘fred fred’
Answer:
DExplanation:
This output will be displayed when the user fred executes the following command:
echo 'fred $USER'
The echo command is a built-in Linux feature that prints out arguments as the standard output. The syntax of the echo command is:
echo [option] [string]
The option can modify the behavior of the echo command, such as enabling the interpretation of escape characters or omitting the newline after the output. The string is the text that is displayed as the output.
The single quotation marks (’ ') are used to enclose the string argument and prevent any expansion or substitution of the characters inside the quotation marks. This means that any variables, commands, or special characters inside the single quotation marks are treated as literal characters, not as expressions.
The $USER variable is a shell variable that holds the username of the current user. However, since it is enclosed in single quotation marks, it is not expanded to its value, but printed as it is.
Therefore, the command echo ‘fred $USER’ will print the string fred $USER as the output, without any changes. The output will be the same for any user who executes the command, not just fred.
The other outputs are incorrect for the following reasons:
A, fred fred: This output would be displayed if the $USER variable was expanded to its value, which is fred for the user fred. However, since the $USER variable is enclosed in single quotation marks, it is not expanded, but printed as it is.
B, fred /home/fred/: This output would be displayed if the $USER variable was expanded to its value, which is fred for the user fred, and then concatenated with the string /home/ to form a path. However, since the $USER variable is enclosed in single quotation marks, it is not expanded, but printed as it is. Also, there is no concatenation operator in the echo command, so the string /home/ would not be added to the output.
C, ‘fred $USER’: This output would be displayed if the single quotation marks were also printed as part of the output. However, the single quotation marks are not part of the string argument, but only used to enclose it and prevent any expansion or substitution. They are not displayed as the output.
E, ‘fred fred’: This output would be displayed if the single quotation marks were also printed as part of the output, and the $USER variable was expanded to its value, which is fred for the user fred. However, neither of these conditions are true. The single quotation marks are not part of the string argument, but only used to enclose it and prevent any expansion or substitution. They are not displayed as the output. The $USER variable is enclosed in single quotation marks, so it is not expanded, but printed as it is.
Which of the following protocols is designed to access the video card output of a virtual machine?
Options:
KDE
X11
Xfce
SPICE
XDMCP
Answer:
DConsider 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.)
Options:
chmod g+s sales
setpol –R newgroup=sales sales
chgrp –p sales sales
chown --persistent *.sales sales
chmod 2775 sales
Answer:
A, EExplanation:
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 the configuration of yum? (Choose two.)
Options:
Changes to the repository configuration become active after running yum confupdate
Changes to the yum configuration become active after restarting the yumd service
The configuration of package repositories can be divided into multiple files
Repository configurations can include variables such as $basearch or $releasever
In case /etc/yum.repos.d/ contains files, /etc/yum.conf is ignored
Answer:
C, DExplanation:
The configuration of yum can be divided into multiple files, and repository configurations can include variables such as $basearch or $releasever. The main configuration file for yum is /etc/yum.conf, which contains the global options for yum and can also define repositories in the [repository] sections. However, it is recommended to define individual repositories in separate files in the /etc/yum.repos.d/ directory, which can be easier to manage and maintain. Each file in this directory should have a .repo extension and contain one or more [repository] sections with the repository name, URL, and other options12. Repository configurations can use yum variables to dynamically set values for certain options, such as the baseurl or the enabled. Yum variables are enclosed in curly braces and start with a dollar sign, such as {$basearch} or {$releasever}. These variables are replaced by their actual values at runtime, based on the system architecture, the operating system version, or other factors. Some of the common yum variables are34:
$basearch: The base architecture of the system, such as x86_64, i386, or arm.
$releasever: The release version of the operating system, such as 7, 8, or 9.
$arch: The exact architecture of the system, such as x86_64, i686, or armv7hl.
$uuid: A unique identifier for the system, generated by the product-id plugin.
$YUM0-$YUM9: Custom variables that can be set by the user in the /etc/yum/vars/ directory or the /etc/yum.conf file.
The other options are false or irrelevant. There is no yum confupdate command or yumd service, and changes to the yum configuration become active immediately after saving the files. The /etc/yum.conf file is not ignored if the /etc/yum.repos.d/ directory contains files, but the repository options in the /etc/yum.conf file can be overridden by the options in the .repo files. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute2
How to Use Yum Variables to Enhance your Yum Experience - Red Hat …3
Yum Variables - CentOS4
How can a specific user be prevented from scheduling tasks with at?
Options:
By adding the specific user to the/etc/at.allow file
By adding the specific user to the 'deny] section in the/etc/atd.conf lile
By adding the specific user to the no jobs group
By adding the specific user to the /etc/at. deny file
By executing the atd —deny [user] command
Answer:
DWhich of the following statements are true about the boot sequence of a PC using a BIOS? (Choose two.)
Options:
Some parts of the boot process can be configured from the BIOS
Linux does not require the assistance of the BIOS to boot a computer
The BIOS boot process starts only if secondary storage, such as the hard disk, is functional
The BIOS initiates the boot process after turning the computer on
The BIOS is started by loading hardware drivers from secondary storage, such as the hard disk
Answer:
A, DExplanation:
The boot sequence of a PC using a BIOS is the process of loading and executing the operating system from the power-on state. The BIOS (Basic Input/Output System) is a firmware program that is stored in a ROM chip on the motherboard and provides the interface between the hardware and the software. The BIOS performs the following tasks during the boot sequence12:
It runs the power-on self-test (POST) to check the integrity and functionality of the hardware components and peripherals.
It reads the BIOS settings from the CMOS memory and applies them to the system configuration. Some parts of the boot process, such as the boot device order, can be configured from the BIOS by pressing a specific key (usually F2, F10, or Del) during the POST.
It locates and loads the boot loader program from the first sector of the boot device, which is usually the hard disk. The boot loader program can be GRUB, LILO, or Windows Boot Manager, depending on the operating system installed. The boot loader is responsible for loading the kernel and the initial ramdisk (initrd) into memory and passing control to them.
It transfers the execution to the boot loader and exits the boot sequence.
The other options are false or irrelevant. Linux does require the assistance of the BIOS to boot a computer, at least until the kernel takes over the hardware control. The BIOS boot process does not start only if secondary storage is functional, it can also boot from other devices such as USB drives, CD-ROMs, or network. The BIOS is not started by loading hardware drivers from secondary storage, it is stored in a ROM chip and runs before any secondary storage is accessed. References:
Linux Essentials - Linux Professional Institute Certification Programs1
Exam 101 Objectives - Linux Professional Institute2
The Linux Booting Process - 6 Steps Described in Detail - freeCodeCamp.org3
Guide to the Boot Process of a Linux System - Baeldung4
Which command is used to set restrictions on the size of a core file that is created for a user when a program crashes?
Options:
core
edquota
quota
ulimit
ktrace