When removing a package, which of the following dpkg options will completely remove the files including configuration files?
--clean
--delete
--purge
–remove
When removing a package on a system using dpkg package management, the --purge option ensures that configuration files are removed as well. The --purge option is equivalent to the --remove option followed by the --purge-config-files option, which removes any configuration files that are marked as obsolete. The --remove option only removes the package files, but leaves the configuration files intact. The --clean option removes any .deb files from the local cache, but does not affect the installed packages. The --delete option is not a valid option for dpkg. References:
The dpkg-____ command will ask configuration questions for a specified package, just as if the package were being installed for the first time.
dpkg-reconfigure
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:
Which of the following is correct when talking about mount points?
Every existing directory can be used as a mount point.
Only empty directories can be used as a mount point.
Directories need to have the SetUID flag set to be used as a mount point.
Files within a directory are deleted when the directory is used as a mount point.
The correct answer when talking about mount points is that every existing directory can be used as a mount point. A mount point is a directory in the Linux file-system where a file system, partition, or storage device can be attached and accessed1. To create a mount point, you need root privileges. Mounting meansmaking 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:
References:
An administrator has issued the following command:
grub-install --root-directory=/custom-grub /dev/sda
In which directory will new configuration files be found? (Provide the full directory path only without the filename)
/custom-grub/boot/grub/
/custom-grub/boot/grub
The command grub-install is used to install GRUB on a device or a partition. The option --root-directory specifies the directory where GRUB images are put. The default is /boot/grub. The argument /dev/sda specifies the device where GRUB is installed, usually the Master Boot Record (MBR) of the disk. Therefore, the command grub-install --root-directory=/custom-grub /dev/sda will install GRUB on the MBR of /dev/sda and put the GRUB images under the directory /custom-grub/boot/grub. This means that the new configuration files, such as grub.cfg, will be found in the directory /custom-grub/boot/grub. References:
Typically, which top level system directory is used for files and data that change regularly while the system is running and are to be kept between reboots? (Specify only the top level directory)
/var
/var/,
Var
var/
The top-level system directory that is used for files and data that change regularly while the system is running and are to be kept between reboots is /var. The /var directory contains variable data that changes in size as the system runs. For instance, log files, mail directories, databases, and printing spools are stored in /var. These files and data are not temporary and need to be preserved across system reboots. The /var directory is one of the few directories that are recommended to be on a separate partition, according to the Filesystem Hierarchy Standard (FHS)1. This is because the /var directory can grow unpredictably and fill up the / partition, which can cause system instability or failure. By having /var on a separate partition, we can limit the amount of disk space that can be used by variable data and prevent users from affecting the / partition. The /var directory is also a common target for malicious attacks, so having it on a separate partition can improve the security and isolation of the system. References:
Which of the following commands updates the linker cache of shared libraries?
mkcache
soconfig
mkldconfig
lddconfig
ldconfig
The command that updates the linker cache of shared libraries is ldconfig. This command creates, updates, and removes the necessary links and cache for the run-time linker, ld.so, to the most recent shared libraries found in the specified directories. To add a new library directory to the cache, you need to edit the /etc/ld.so.conf file and rerun ldconfig. You can use the -p option to print the current cache contents1.
The other commands are either invalid or unrelated to the linker cache. mkcache, soconfig, and mkldconfig are not standard Linux commands. lddconfig is a typo for ldd, which is a command that prints the shared libraries required by a program2.
References:
Which of the following commands can be used to download the RPM package kernel without installing it?
yum download --no-install kernel
yumdownloader kernel
rpm --download --package kernel
rpmdownload kernel
The command that can be used to download the RPM package kernel without installing it is yumdownloader kernel. This command is part of the yum-utils package, which contains a suite of helper tools for yum package manager. To use this command, you need to install the yum-utils package first1. The downloaded package will be saved in the current directory. You need to use root privilege because yumdownloader will update package index files during downloading. Unlike yum command, yumdownloader will not download any dependent packages1.
The other commands are either invalid or do not have the desired functionality. yum download --no-install kernel is not a valid yum command, as yum does not have a --no-install option2. rpm --download --package kernel is not a valid rpm command, as rpm does not have a --download or a --package option3. rpmdownload kernel is not a standard Linux command. rpm has a native support to download a package from a URL and install it, but not to download a package without installing it4.
References:
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?
LD_LOAD_PATH
LD_LIB_PATH
LD_LIBRARY_PATH
LD_SHARE_PATH
LD_RUN_PATH
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 librarysearch path in the executable at link time, but it is not an environment variable that can be set or modified at run time2. References:
Which of the following commands overwrites the bootloader located on /dev/sda without overwriting the partition table or any data following it?
dd if=/dev/zero of=/dev/sda bs=512
dd if=/dev/zero of=/dev/sda bs=512 count=1
dd if=/dev/zero of=/dev/sda bs=440 count=1
dd if=/dev/zero of=/dev/sda bs=440
The dd command is used to copy data from one device or file to another, with optional parameters to specify the block size (bs), the number of blocks to copy (count), and other options. The bootloader is typically located in the first 440 bytes of the disk, which is the Master Boot Record (MBR) area. The MBR also contains the partition table, which starts at byte 446 and occupies 64 bytes. Therefore, to overwrite the bootloader without affecting the partition table or any data following it, the command should copy 440 bytes from /dev/zero (a special device that provides null bytes) to /dev/sda (the disk device) and stop after one block. This is achieved by the command: dd if=/dev/zero of=/dev/sda bs=440 count=1 References:
Which function key is used to start Safe Mode in Windows NT?
F10
F8
F6
Windows NT does not support Safe Mode
The function key that is used to start Safe Mode in Windows NT is none of the above, because Windows NT does not support Safe Mode. Safe Mode is a diagnostic mode of Windows that starts the system with minimal drivers and services, allowing the user to troubleshoot problems and restore the system to anormal 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:
References:
Which of the following environment variables overrides or extends the list of directories holding shared libraries?
LD_LOAD_PATH
LD_LIB_PATH
LD_LIBRARY_PATH
LD_SHARE_PATH
LD_RUN_PATH
The environment variable that overrides or extends the list of directories holding shared libraries is LD_LIBRARY_PATH. This variable is used to specify a colon-separated list of directories where the dynamic linker should look for shared libraries when loading a program1. The directories in LD_LIBRARY_PATH are searched before the default directories, such as /lib and /usr/lib, or the directories specified in/etc/ld.so.conf or the executable’s rpath1. This variable can be useful for testing or debugging purposes, or for running programs that require a specific version of a library that is not installed in the system1.
The other options are incorrect for the following reasons:
References:
Which world-writable directory should be placed on a separate partition in order to prevent users from being able to fill up the / filesystem? (Specify the full path to the directory.)
/tmp
Answer:tmp,
Answer:/var/tmp/
Answer:/var/tmp/
Answer:A
The world-writable directory that should be placed on a separate partition in order to prevent users from being able to fill up the / filesystem is /tmp. This directory is used by applications and users to store temporary files, and it is world-writable by default. By creating a separate partition for /tmp, the amount ofspace 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.
References:
Which of the following statements is correct regarding the command foo 1> bar?
The stdout from the command foo is appended to the file bar.
The stdout from the command foo overwrites the file bar.
The command foo receives its stdin from the file bar.
The command foo receives its stdin from the stdout of the command bar.
The stderr from the command foo is saved to the file bar.
The command foo 1> bar redirects the standard output (stdout) from the command foo to the file bar, overwriting the existing contents of the file. The number 1 before the redirection operator > indicates the file descriptor of the stdout stream, which is 1 by default. The redirection operator > means that the outputof the command is written to the file, replacing any previous data in the file. The file name after the redirection operator is the destination of the output. For example, if the command foo prints “Hello world” to the stdout, and the file bar contains “Goodbye world”, the command foo 1> bar will write “Hello world” to the file bar, erasing “Goodbye world”. The other options are not correct because:
When given the following command line.
echo "foo bar" | tee bar | cat
Which of the following output is created?
cat
foo bar
tee bar
bar
foo
The output of the given command line is foo bar. The command line consists of three commands that are connected by pipes (|). A pipe is a symbol that redirects the standard output of one command to the standard input of another command. The echo command prints its argument to the standard output, which is foo bar in this case. The tee command reads from the standard input and writes to both the standard output and a file. The file name is given as an argument, which is bar in this case. The cat command reads from the standard input and writes to the standard output. Therefore, the command line does the following:
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:
Which of the following files, located in the user home directory, is used to store the Bash history?
.bash_history
.bash_histfile
.history
.bashrc_history
.history_bash
The .bash_history file, located in the user home directory, is used to store the Bash history. The Bash history is a list of commands that the user has entered in the Bash shell. The .bash_history file is created when the user first starts a Bash session, and is updated when the user exits the session or runs the history command with the -a or -w option. The user can view the contents of the .bash_history file with the cat command, or use the history command to see the numbered list of commands. The user can also edit, delete, or clear the .bash_history file with various commands and options. The location and name of the history file can be changed by setting the HISTFILE environment variable to a different value. References:
QUESTIONNO: 26
Which Bash environment variable defines in which file the user history is stored when exiting a Bash process? (Specify ONLY the variable name.)
Answer: HISTFILE
The HISTFILE environment variable defines in which file the user history is stored when exiting a Bash process. The user history is a list of commands that the user has entered in the Bash shell. By default, the HISTFILE variable is set to ~/.bash_history, which means that the history is stored in a hidden file called .bash_history in the user’s home directory. The user can change the value of the HISTFILE variable to store the history in a different file or location. For example, the following command will set the HISTFILE variable to ~/my_history:
export HISTFILE=~/my_history
This will cause the history to be stored in a file called my_history in the user’s home directory. The user can also unset the HISTFILE variable to disable the history saving feature. For example, the following command will unset the HISTFILE variable:
unset HISTFILE
This will prevent the history from being written to any file when the Bash process exits. The user can view the value of the HISTFILE variable by using the echo command. For example, the following command will display the value of the HISTFILE variable:
echo $HISTFILE
The output will be something like:
/home/user/.bash_history
References:
What does the + symbol mean in the following grep regular expression:
grep '^d[aei]\+d$' /usr/share/dict/words
Match the preceding character set ([aei]) one or more times.
Match the preceding character set ([aei]) zero or more times.
Match the preceding character set ([aei]) zero or one times.
Match a literal + symbol.
The + symbol in a grep regular expression means to match the preceding character or character set one or more times. In other words, it means to repeat the previous element at least once. For example, the regular expression ^d[aei]\+d$ will match any word that starts and ends with d and has one or more of the letters a, e or i in between. Some examples of words that match this pattern are dead, deed, died, daiid, etc. The other options are either incorrect or not applicable. The * symbol means to match the preceding character or character set zero or more times. The ? symbol means to match the preceding character or character set zero or one times. The \+ symbol means to match a literal + symbol, not a repetition modifier. References:
In Bash, inserting 1>&2 after a command redirects
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.
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:
When starting a program with the nice command without any additional parameters, which nice level is set for the resulting process?
-10
0
10
20
When starting a program with the nice command without any additional parameters, the nice level is set to 10 for the resulting process. This means that the process will have a lower priority than the default value of 0, and will be more willing to yield CPU time to other processes. The nice command can also take an optional argument -n followed by a number, which specifies the increment or decrement of the nice value from the default value of 0. For example, the command:
nice -n 5 /usr/bin/prog
will start the /usr/bin/prog process with a nice value of 5, which means a lower priority than the default. Similarly, the command:
nice -n -5 /usr/bin/prog
will start the /usr/bin/prog process with a nice value of -5, which means a higher priority than the default. If the -n argument is omitted, the nice command will assume a default increment of 10. For example, the command:
nice /usr/bin/prog
will start the /usr/bin/prog process with a nice value of 10, which means a very low priority. Note that only the root user can start a process with a negative nice value, as this requires special privileges.
References:
Which of the following sequences in the vi editor saves the opened document and exits the editor? (Choose TWO correct answers.)
esc ZZ
ctrl :w!
esc zz
esc :wq!
ctrl XX
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:
The other options are incorrect because:
References:
Which of the following signals is sent to a process when the key combination CTRL+C is pressed on the keyboard?
SIGTERM
SIGINT
SIGSTOP
SIGKILL
The SIGINT signal is sent to a process when the user presses the key combination CTRL+C on the keyboard. This signal is used to interrupt the process and cause it to terminate, unless the process catches or ignores the signal. The SIGTERM signal is the default signal sent by the kill command to request a process to terminate gracefully. The SIGSTOP signal is used to pause a process and make it stop executing until it receives a SIGCONT signal. The SIGKILL signal is used to force a process to terminate immediately and cannot be caught or ignored by the process. References:
Which command is used in a Linux environment to create a new directory? (Specify ONLY the command without any path or parameters.)
A
The mkdir command is used in a Linux environment to create a new directory. The mkdir command takes one or more arguments that specify the name and path of the directory to be created. For example, mkdir foo will create a directory named foo in the current working directory, while mkdir /home/bar will create a directory named bar in the /home directory. The mkdir command can also create multiple directories at once by using the -p option, which creates any missing parent directories along the path. For example, mkdir -p /tmp/a/b/c will create the directories /tmp, /tmp/a, /tmp/a/b and /tmp/a/b/c if they do not exist already. References:
Which variable defines the directories in which a Bash shell searches for executable commands?
BASHEXEC
BASHRC
PATH
EXECPATH
PATHRC
The PATH variable defines the directories in which a Bash shell searches for executable commands. The PATH variable is a colon-separated list of directories that the shell scans when a command is entered. For example, if the PATH variable is set to /usr/local/bin:/usr/bin:/bin, then the shell will look for the command in these three directories, in order. If the command is not found in any of these directories, the shell will report an error message. The other options are either invalid or do not perform the desired task. The BASHEXEC, EXECPATH and PATHRC variables are not valid Bash variables. The BASHRC variable is used to specify a file that is executed whenever a new interactive shell is started, but it does not affect the command search path. References:
When running the command
sed -e "s/a/b/" /tmp/file >/tmp/file
While /tmp/file contains data, why is /tmp/file empty afterwards?
The file order is incorrect. The destination file must be mentioned before the command to ensure redirection.
The command sed did not match anything in that file therefore the output is empty.
When the shell establishes the redirection it overwrites the target file before the redirected command starts and opens it for reading.
Redirection for shell commands do not work using the > character. It only works using the | character instead.
The problem with the command
sed -e “s/a/b/” /tmp/file >/tmp/file
is that it tries to read and write from the same file, which results in overwriting the file before the command can process it. The shell sets up the redirection by opening the file /tmp/file for writing and truncating it to zero length. Then it executes the sed command, which tries to read from the same file, but finds it empty. Therefore, the output is also empty and the file remains empty. A possible solution is to use a temporary file for the output and then rename it to the original file name. For example:
sed -e “s/a/b/” /tmp/file >/tmp/file.tmp && mv /tmp/file.tmp /tmp/file
This way, the original file is not overwritten until the sed command finishes successfully. The other options are either incorrect or not applicable. The file order is correct, the sed command does match something in the file, and the > character is valid for redirection. The | character is used for piping, not redirection. References:
What happens after issuing the command vi without any additional parameters?
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.
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:
What is the default action of the split command on an input file?
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.
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:
Which of the following commands displays the contents of a gzip compressed tar archive?
gzip archive.tgz | tar xvf -
tar ztf archive.tgz
gzip -d archive.tgz | tar tvf -
tar cf archive.tgz
The command that displays the contents of a gzip compressed tar archive is tar ztf archive.tgz. This command uses the following options:
-z: Tells tar to read or write archives through gzip, allowing it to work on compressed files directly. -t: Lists the contents of an archive without extracting it. -f archive.tgz: Specifies the name of the archive file.
The output of this command will show the names of the files and directories stored in the archive, one per line. For example, if the archive contains three files named file1, file2, and file3, the output will be:
file1 file2 file3
The other commands are incorrect for the following reasons:
Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?
fmt -f 1,4 /etc/passwd
split -c 1,4 /etc/passwd
cut -d : -f 1,4 /etc/passwd
paste -f 1,4 /etc/passwd
The cut command is used to extract selected fields from each line of a file. The -d option specifies the delimiter that separates the fields, and the -f option specifies the fields to print. The /etc/passwd file contains information about the users on the system, and each field is separated by a colon (:). Therefore, cut -d : -f 1,4 /etc/passwd will print the first and fourth fields of each line, which are the username and the primary group ID respectively. The other commands are either invalid or do not perform the desired task. The fmt command is used to reformat paragraphs of text, but it does not have a -f option. The split command is used to split a file into smaller files, but it does not have a -c option. The paste command is used to merge lines of files, but it does not have a -f option. References:
When is the content of the kernel ring buffer reset? (Choose two.)
When the ring buffer is explicitly reset using the command dmesg --clear
When the ring buffer is read using dmesg without any additional parameters
When a configurable amount of time, 15 minutes by default, has passed
When the kernel loads a previously unloaded kernel module
When the system is shut down or rebooted
The content of the kernel ring buffer is reset when the ring buffer is explicitly reset using the command dmesg --clear or when the system is shut down or rebooted. The kernel ring buffer is a portion of the physical memory that holds the kernel’s log messages. It has a fixed size, which means once the buffer is full, the older logs records are overwritten. The dmesg command-line utility is used to print and control the kernel ring buffer in Linux and other Unix-like operating systems1. The dmesg --clear option clears the ring buffer’s contents, which can be useful for debugging purposes or to free up some memory2. The systemshutdown or reboot also clears the ring buffer’s contents, as the physical memory is reset and the kernel is reloaded3.
The other options are false or irrelevant. The ring buffer is not reset when it is read using dmesg without any additional parameters, as this option only displays the current contents of the buffer without modifying them2. The ring buffer is not reset when a configurable amount of time, 15 minutes by default, has passed, as there is no such time limit for the buffer’s persistence4. The ring buffer is not reset when the kernel loads a previously unloaded kernel module, as this action only affects the kernel’s functionality and not its log messages5. References:
What is true regarding UEFI firmware? (Choose two.)
It can read and interpret partition tables
It can use and read certain file systems
It stores its entire configuration on the /boot/ partition
It is stored in a special area within the GPT metadata
It is loaded from a fixed boot disk position
UEFI firmware is a software program that provides the interface between the hardware and the operating system on a computer. UEFI stands for Unified Extensible Firmware Interface and it is a replacement for the traditional BIOS (Basic Input/Output System). UEFI firmware has several advantages over BIOS, such asfaster boot times, better security, larger disk support, and graphical user interface. Some of the features of UEFI firmware are12:
The other options are false or irrelevant. UEFI firmware does not read and interpret partition tables, it relies on the operating system to do that. UEFI firmware does not store its entire configuration on the /boot/ partition, it stores some of its settings in the NVRAM (Non-Volatile Random Access Memory) on the motherboard and some of its files on the ESP. UEFI firmware is not stored in a special area within the GPT (GUID Partition Table) metadata, it is stored in a ROM chip and an ESP. GPT is a partitioning scheme that supports larger disks and more partitions than the legacy MBR scheme. References:
What does the command mount --bind do?
It makes the contents of one directory available in another directory
It mounts all available filesystems to the current directory
It mounts all user mountable filesystems to the user’s home directory
It mounts all file systems listed in /etc/fstab which have the option userbind set
It permanently mounts a regular file to a directory
The mount --bind command is used to create a bind mount, which is an alternate view of a directory tree. A bind mount takes an existing directory tree and replicates it under a different point. The directories and files in the bind mount are the same as the original. Any modification on one side is immediately reflected on the other side, since the two views show the same data. For example, after issuing the command:
mount --bind /some/where /else/where
the directories /some/where and /else/where have the same content, which is the content of /some/where. A bind mount can be useful for accessing hidden files, creating chroot environments, or changing the permissions or ownership of files.
The other options are not correct because:
References:
Which of the following directories on a 64-bit Linux system typically contain shared libraries? (Choose two.)
~/.lib64/
/usr/lib64/
/var/lib64/
/lib64/
/opt/lib64/
The directories on a 64 bit Linux system that typically contain shared libraries are /usr/lib64/ and /lib64/. Shared libraries are binary files that provide reusable functions, routines, classes, data structures, and so on for programs and applications. They are loaded into memory before the program starts and shared by multiple processes that use the same library. Shared libraries are usually stored in standard locations in the file system, such as /usr/lib, /usr/local/lib, /lib, and /lib64 for 32 bit systems, and /usr/lib64, /usr/local/lib64, /lib64, and /lib for 64 bit systems12. The /usr/lib64 and /lib64 directories contain the shared libraries for the system and user applications, respectively. The other directories are either non-existent or do not contain shared libraries. The ~/.lib64/ directory is not a standard location for shared libraries, and it is unlikely that a user would have such a directory in their home directory. The /var/lib64/ directory is also not a standard location for shared libraries, and it is usually used for variable data files that are specific to a package or application. The /opt/lib64/ directory is not a standard location for shared libraries, and it is usually used for optional software packages that are installed in the /opt directory3. References:
Which of the following commands list all files and directories within the /tmp/ directory and its subdirectories which are owned by the user root? (Choose two.)
find /tmp –user root -print
find –path /tmp –uid root
find /tmp –uid root -print
find /tmp –user root
find –path /tmp –user root -print
The find command can be used to search for files and directories that match certain criteria, such as ownership, permissions, size, type, name, etc. The syntax of the find command is:
find [options] [path...] [expression]
The options can modify the behavior of the find command, such as how to handle symbolic links, how to optimize the search, or how to enable debugging. The path argument specifies the starting point of the search, which can be one or more directories. The expression argument consists of one or more tests, actions, and operators that are applied to each file or directory that is found.
The -user test matches files or directories that are owned by a given user. The user can be specified by name or by numeric user ID (UID). The -print action prints the full file name of the matching file or directory on the standard output, followed by a newline. If no action is specified, -print is assumed by default.
Therefore, to list all files and directories within the /tmp/ directory and its subdirectories which are owned by the user root, we can use either of the following commands:
Both commands will search recursively from the /tmp/ directory and print the full file names of the files or directories that are owned by the user root. The -print action is optional in this case, since it is the default action.
The other commands are incorrect for the following reasons:
References:
Which of the following statements are true about the boot sequence of a PC using a BIOS? (Choose two.)
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
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:
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:
Which daemon handles power management events on a Linux system?
acpid
batteryd
pwrmgntd
psd
inetd
The daemon that handles power management events on a Linux system is acpid. A daemon is a background process that runs continuously and performs certain tasks without user intervention. The acpid daemon listens for power management related events, such as switching between AC and battery power on a laptop, pressing the power button, closing the lid, etc., and executes various commands in response. The acpid daemon can be configured by editing the files in /etc/acpi/events and /etc/acpi/actions directories, or by using a graphical tool like gnome-power-manager or xfce4-power-manager. The acpid daemon is part of the 101.1 Determine and configure hardware settings topic of the LPI Linux Essentials certification program12. References:
What is true regarding the configuration of yum? (Choose two.)
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
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:
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:
Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?
fmt –f 1,4 /etc/passwd
cut –d : -f 1,4 /etc/passwd
sort –t : -k 1,4 /etc/passwd
paste –f 1,4 /etc/passwd
split –c 1,4 /etc/passwd
The command that prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file is cut -d : -f 1,4 /etc/passwd. The cut command is used to extract selected fields or characters from each line of a file or standard input. The -d or --delimiter option specifies the character that separates the fields, which in this case is a colon (:). The -f or --fields option specifies the fields to be printed, which in this case are the first and the fourth fields. The /etc/passwd file is a text file that contains information about the user accounts on the system, such as the username, password, user ID, group ID, home directory, and login shell. The first column of the file is the username and the fourth column is the group ID, which corresponds to the primary group of the user. The cut command will print these two columns separated by a colon for each line of the file. For example, running cut -d : -f 1,4 /etc/passwd will produce an output like this:
root:0 daemon:1 bin:1 sys:3 sync:4 games:5 man:12 lp:7 mail:8 news:9 uucp:10 proxy:13 www-data:33 backup:34 list:38 irc:39 gnats:41 nobody:65534 systemd-network:100 systemd-resolve:101 syslog:102 messagebus:103 _apt:104 lxd:105 uuidd:106 dnsmasq:107 sshd:108 pollinate:109 vboxadd:999 ubuntu:1000
The other commands are either invalid or do not perform the desired task. The fmt command is used to reformat paragraphs of text, but it does not have a -f option. The sort command is used to sort lines of text, but it does not have a -t option. The paste command is used to merge lines of files, but it does not have a -f option. The split command is used to split a file into pieces, but it does not have a -c option. References:
Which of the following commands installs all packages with a name ending with the string foo?
zypper get “*foo”
zypper update “foo?”
zypper force “foo*”
zypper install “*foo”
zypper add “.*foo”
The command that installs all packages with a name ending with the string foo is zypper install “*foo”. The zypper command is the command line interface of the ZYpp package manager for SUSE Linux. The install (in) subcommand is used to install packages with specified capabilities or RPM files with specified location. The argument “*foo” is a glob pattern that matches any package name that ends with foo. For example, zypper install “foo" will install packages like barfoo, bazfoo, and foo itself. The other commands are either invalid or do not perform the desired task. The zypper get, zypper update, zypper force, and zypper add subcommands do not exist. The “foo?” and "foo” arguments are also invalid glob patterns, as they do not match the end of the package name. The “.*foo” argument is a valid glob pattern, but it matches any package name that contains foo, not just the ones that end with foo. References:
Consider the following output from the command ls –i:
How would a new file named c.txt be created with the same inode number as a.txt (Inode 525385)?
ln –h a.txt c.txt
ln c.txt a.txt
ln a.txt c.txt
ln –f c.txt a.txt
ln –i 525385 c.txt
This command creates a hard link to a.txt with the name c.txt. The new file c.txt will have the same inode number as a.txt (Inode 525385).
A hard link is a directory entry that points to the same data blocks as another file. A hard link is indistinguishable from the original file, and it shares the same inode number, permissions, ownership, and timestamps. A hard link can only be created within the same file system, and it cannot link to directories or special files. A hard link increases the link count of the file, which is the number of directory entries that refer to the file. The link count can be seen by using the ls -l command. The file is only deleted when the link count reaches zero, which means that all the hard links to the file are removed.
The ln command is used to create hard links or symbolic links. The syntax of the ln command is:
ln [options] source target
The source is the name of the existing file, and the target is the name of the new link. By default, the ln command creates a hard link, unless the -s option is used to create a symbolic link. A symbolic link is a special file that contains the path to another file or directory. A symbolic link is different from a hard link, as ithas its own inode number, permissions, ownership, and timestamps. A symbolic link can link to any file or directory, even across file systems, and it does not affect the link count of the file. A symbolic link can be identified by the ls -l command, as it shows the link name followed by an arrow and the target name.
For example, to create a hard link to a.txt with the name c.txt, use the following command:
ln a.txt c.txt
This command will create a new file c.txt that has the same inode number as a.txt (Inode 525385). The output of the ls -i command will show something like:
525385 a.txt 525385 c.txt
To create a symbolic link to a.txt with the name b.txt, use the following command:
ln -s a.txt b.txt
This command will create a new file b.txt that has a different inode number than a.txt (Inode 526053), and contains the path to a.txt. The output of the ls -i command will show something like:
525385 a.txt 526053 b.txt -> a.txt
References:
Which command uninstalls a package but keeps its configuration files in case the package is re-installed?
dpkg –s pkgname
dpkg –L pkgname
dpkg –P pkgname
dpkg –v pkgname
dpkg –r pkgname
The command that uninstalls a package but keeps its configuration files in case the package is re-installed is dpkg -r pkgname. The dpkg command is the low-level tool for installing, building, removing, and managing Debian packages. The -r or --remove option removes an installed package from the system, but it does not delete the configuration files and other data that belong to the package. This way, if the package is re-installed later, the previous settings are preserved. The dpkg command is part of the 101.1 Determine and configure hardware settings topic of the LPI Linux Essentials certification program12.
The other options are either invalid or do not perform the desired task. The dpkg -s pkgname command shows the status of an installed package, but it does not uninstall it. The dpkg -L pkgname command lists the files that belong to an installed package, but it does not uninstall it. The dpkg -P pkgname command purges an installed or removed package, which means it deletes the configuration files and other data that belong to the package. The dpkg -v pkgname command shows the version of an installed package, but it does not uninstall it.
Which of the following regular expressions represents a single upper-case letter?
:UPPER:
[A-Z]
!a-z
%C
{AZ}
The regular expression that represents a single upper-case letter is [A-Z]. This is a character class that matches any one character from the range A to Z, which are the 26 upper-case letters of the English alphabet. A character class is enclosed in square brackets and can contain a list or a range of characters to match. For example, [abc] matches any one of the letters a, b, or c, and [0-9] matches any one digit from 0 to 9. The other options are not valid regular expressions for a single upper-case letter. The :UPPER: option is not a valid syntax for a character class, and it would be interpreted as a literal string of seven characters. The !a-z option is not a valid syntax for a negated character class, and it would be interpreted as a literal string of four characters. The %C option is not a valid syntax for a character class, and it would be interpreted as a literal string of two characters. The {AZ} option is not a valid syntax for a character class, and it would be interpreted as a literal string of four characters. The curly braces are used for interval expressions, which specify the number of repetitions of a character or a group of characters. For example, a{2,4} matches the letter a repeated two, three, or four times. References:
Which of the following vi commands deletes two lines, the current and the following line?
d2
2d
2dd
dd2
de12
The correct answer is C, 2dd. This command will delete two lines, the current and the following line, in vi editor. The syntax of the command is:
[number]dd
The number specifies how many lines to delete, starting from the current line. The dd command deletes the lines and puts them in a buffer, which can be pasted later with the p command. If no number is given, the command will delete only the current line.
The other commands are incorrect for the following reasons:
d[motion]
The motion specifies how many characters to delete, starting from the current cursor position. The 2 motion means two characters to the right. The d command deletes the characters and puts them in a buffer, which can be pasted later with the p command.
dd[number]
The dd command deletes the current line and puts it in a buffer, which can be pasted later with the p command. The number specifies how many lines to move the cursor down, after deleting the current line. If no number is given, the command will move the cursor to the next line.
d[motion][number]
The d command deletes the characters specified by the motion and puts them in a buffer, which can be pasted later with the p command. The e motion means the end of the word. The number specifies the line number to move the cursor to, after deleting the characters.
References:
Which of the following commands displays the path to the executable file that would be executed when the command foo is invoked?
lsattr foo
apropos foo
locate foo
whatis foo
which foo
This command will display the path to the executable file that would be executed when the command foo is invoked. The syntax of the command is:
which [options] command
The which command is a utility that searches the directories listed in the PATH environment variable for the executable file that matches the given command. The options can modify the behavior of the which command, such as displaying all matches, ignoring aliases, or showing the version. The command is the name of the command to be located.
Therefore, the command which foo will search the PATH directories for the executable file named foo and print its full path on the standard output. If there are multiple matches, the command will print the first one found. If there is no match, the command will print nothing and return an exit status of 1.
The other commands are incorrect for the following reasons:
lsattr [options] [file]
The lsattr command is a utility that lists the file attributes on a Linux second extended file system. The options can modify the behavior of the lsattr command, such as displaying the output in long format, recursing into subdirectories, or suppressing errors. The file is the name of the file whose attributes are to be listed. If no file is given, the command will list the attributes of all files in the current directory.
Therefore, the command lsattr foo will list the file attributes of the file named foo in the current directory, if it exists. If it does not exist, the command will report an error and return an exit status of 1.
apropos [options] keyword
The apropos command is a utility that searches the whatis database for the keyword and prints the manual page names and descriptions that match. The whatis database is a set of files containing short descriptions of system commands and programs. The options can modify the behavior of the apropos command, such as using regular expressions, ignoring case, or displaying the section numbers. The keyword is the word to be searched in the whatis database.
Therefore, the command apropos foo will search the whatis database for the word foo and print the manual page names and descriptions that contain it. If there are no matches, the command will print nothing and return an exit status of 1.
locate [options] pattern
The locate command is a utility that searches a database of file names and prints the file names that match the given pattern. The database is updated periodically by the updatedb command and may not reflect the current state of the file system. The options can modify the behavior of the locate command, such as using regular expressions, ignoring case, or limiting the number of results. The pattern is the string to be matched in the file names.
Therefore, the command locate foo will search the database of file names and print the file names that contain the string foo. If there are no matches, the command will print nothing and return an exit status of 1.
whatis [options] name
The whatis command is a utility that searches the whatis database for the name and prints the manual page name and description that match. The whatis database is a set of files containing short descriptions of system commands and programs. The options can modify the behavior of the whatis command, such as displaying the section numbers, using wildcards, or searching in a specific section. The name is the name of the command or program to be described.
Therefore, the command whatis foo will search the whatis database for the name foo and print the manual page name and description that match. If there are no matches, the command will print nothing and return an exit status of 1.
References:
What is the first program that is usually started, at boot time, by the Linux kernel when using SysV init?
/lib/init.so
/sbin/init
/etc/rc.d/rcinit
/proc/sys/kernel/init
/boot/init
The first program that is usually started, at boot time, by the Linux kernel when using SysV init is /sbin/init. This program is responsible for reading the /etc/inittab file and executing the appropriate scripts and programs for each runlevel. The other options are not valid programs that are started by the kernel. /lib/init.so is a shared library that is used by some init programs, but not by SysV init. /etc/rc.d/rcinit is a script that is run by init, not by the kernel. /proc/sys/kernel/init is a kernel parameter that can be used to specify a different init program, but the default value is /sbin/init. /boot/init is not a standard location for an init program, and it is unlikely that the kernel would find it there. References:
You are having some trouble with a disk partition and you need to do maintenance on this partition but your users home directories are on it and several are logged in. Which command would disconnect the users and allow you to safely execute maintenance tasks?
telinit 1
shutdown -r now
killall -9 inetd
/bin/netstop --maint
/etc/rc.d/init.d/network stop
The command that would disconnect the users and allow you to safely execute maintenance tasks on a disk partition is telinit 112. The telinit command is used to change the runlevel of the system, which is a mode of operation that defines what processes and services are running3. The runlevel 1, also known as single-user mode, is a mode that allows only the root user to log in, and disables all network services and graphical interfaces4. This mode is useful for performing system maintenance and recovery tasks, such as repairing a disk partition5.
The other options in the question are not correct because:
References:
1: How to Change Runlevels (targets) in SystemD - Tecmint 2: How to Boot into Single User Mode in CentOS/RHEL 7 - Tecmint 3: Runlevel - Wikipedia 4: Single-user mode - Wikipedia 5: How to Repair a Corrupted Linux File System - Linux.com : [shutdown(8) - Linux manual page] : [inetd(8) - Linux manual page] : [How to Start/Stop or Enable/Disable firewalld on CentOS 7 - Tecmint]
The message "Hard Disk Error" is displayed on the screen during Stage 1 of the GRUB boot process. What does this indicate?
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
The GRUB boot process consists of three stages1:
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:
References:
1: GRUB - ArchWiki 2: GNU GRUB Manual 0.97 3: Stage1 errors - GNU GRUB Manual 0.97 4: [Kernel panic - Wikipedia] 5: [Stage2 errors - GNU GRUB Manual 0.97] 6: [Master Boot Record - Wikipedia] : How to Fix GRUB Load Errors and Recover Data? - MiniTool Home Data Recovery
The system is having trouble and the engineer wants to bypass the usual /sbin/init start up and run /bin/sh. What is the usual way to pass this change to the kernel from your boot loader?
Start in runlevel 1.
Pass init=/bin/sh on the kernel parameter line.
Pass /bin/sh on the kernel parameter line.
Pass start=/bin/sh on the kernel parameter line.
The usual way to pass this change to the kernel from the boot loader is to pass init=/bin/sh on the kernel parameter line12. The init kernel parameter is used to specify the program that is run as the first process after the kernel is loaded3. By default, this program is /sbin/init, which is responsible for starting and managing other processes and services4. However, by passing init=/bin/sh, the kernel will run /bin/sh instead, which is a shell program that allows the user to execute commands interactively or from a script5. This way, the user can bypass the usual initialization process and run /bin/sh as the root user, which can be useful for troubleshooting or recovery purposes12.
The other options in the question are not correct because:
References:
1: How to pass arguments to a Linux kernel init= bootparam? - Unix & Linux Stack Exchange 2: kernel parameter init=/bin/bash not working? (RHEL7, RHCSA test) - Unix & Linux Stack Exchange 3: The kernel’s command-lineparameters — The Linux Kernel documentation 4: [init - Wikipedia] 5: [sh - Wikipedia] : [Single-user mode - Wikipedia] : How to Change Runlevels (targets) in SystemD - Tecmint
Which of the following information is stored within the BIOS? (Choose TWO correct answers.)
Boot device order
Linux kernel version
Timezone
Hardware configuration
The system's hostname
The BIOS (Basic Input/Output System) is a firmware that is stored in a ROM chip on the motherboard and is responsible for initializing the hardware and loading the bootloader. The BIOS has a setup utility that allows the user to configure various settings, such as the boot device order, the hardware configuration, the system date and time, the security options, etc. The BIOS does not store information about the Linux kernel version, the time zone, or the system’s hostname, as these are part of the operating system and are not relevant for the BIOS. References: LPI Linux Essentials - 1.101.1, LPI Linux Administrator - 102.1
What information can the lspci command display about the system hardware? (Choose THREE correct answers.)
Device IRQ settings
PCI bus speed
System battery type
Device vendor identification
Ethernet MAC address
The lspci command can display information about the system hardware, such as:
References: 1: https://www.man7.org/linux/man-pages/man8/lspci.8.html 2: https://phoenixnap.com/kb/lspci-command 3: https://en.wikipedia.org/wiki/Lspci
Which of the following commands reboots the system when using SysV init? (Choose TWO correct answers.)
shutdown -r now
shutdown -r "rebooting"
telinit 6
telinit 0
shutdown -k now "rebooting"
The shutdown command is used to bring the system down in a safe and controlled way. It can take various options and arguments, such as the time of shutdown, the message to broadcast to users, the halt or reboot mode, etc. The option -r instructs the shutdown command to reboot the system after shutting down. The argument now means to shut down immediately. Therefore, shutdown -r now will reboot the system without delay. The telinit command is used to change the run level of the system. It takes a single argument that specifies the new run level. The run level 6 is reserved for rebooting the system. Therefore, telinit 6 will also reboot the system. The other options are either incorrect or irrelevant. shutdown -r “rebooting” will also reboot the system, but with a delay of one minute and a message to the users. telinit 0 will halt the system, not reboot it. shutdown -k now “rebooting” will only send a warning message to the users, but not actually shut down or reboot the system. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.3
Which SysV init configuration file should be modified to disable the ctrl-alt-delete key combination?
/etc/keys
/proc/keys
/etc/inittab
/proc/inittab
/etc/reboot
The /etc/inittab file is used by the SysV init system to configure the behavior of different runlevels and the actions to be taken when certain events occur. One of the events that can be configured is the ctrl-alt-delete key combination, which by default triggers a system reboot. To disable this feature, the /etc/inittab file should be modified to comment out or remove the line that starts with ca::ctrlaltdel:. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.1
Which of the following commands brings a system running SysV init into a state in which it is safe to perform maintenance tasks? (Choose TWO correct answers.)
shutdown -R 1 now
shutdown -single now
init 1
telinit 1
runlevel 1
The commands init 1 and telinit 1 both bring a system running SysV init into a state in which it is safe to perform maintenance tasks. This state is also known as single-user mode or runlevel 1, where only the root user can log in and no network services are running. The command shutdown -R 1 now is incorrect, because it reboots the system instead of entering single-user mode. The command shutdown -single now is invalid, because the -single option does not exist for the shutdown command. The command runlevel 1 is also invalid, because runlevel is a command that displays the current and previous runlevels, not a command that changes the runlevel. References:
Which file in the /proc filesystem lists parameters passed from the bootloader to the kernel? (Specify the file name only without any path.)
cmdline
The file in the /proc filesystem that lists the parameters passed from the bootloader to the kernel is /proc/cmdline. This file contains a single line of text that shows the command line arguments that were used to boot the kernel. These arguments can include various options, such as the root device, the init process, the console device, and more. The /proc/cmdline file is read-only and cannot be modified at runtime. The parameters in this file are determined by the bootloader configuration, such as GRUB or LILO, and can be changed by editing the corresponding files12.
References: 1: The /proc Filesystem — The Linux Kernel documentation 2: passing bootloader arguments to the kernel - Unix & Linux Stack Exchange
Which of the following commands will write a message to the terminals of all logged in users?
bcast
mesg
wall
yell
The wall command is a command-line utility that displays messages to all logged-in users on the terminal12. The wall command takes the following basic syntax:
$ wall OPTION { file | message }
The OPTION can be one of the following:
The file or message argument is the source of the message to be displayed. If a file is specified, the wall command will read the message from the file. If a message is specified, the wall command will read the message from the standard input. The message can be terminated by pressing Ctrl+D.
The other commands in the options are not valid or do not have the same functionality as the wall command:
References:
1: How to Send a Message to Logged Users in Linux Terminal - Tecmint 2: How to Send Broadcast Messages to Users in Linux Terminal
You suspect that a new ethernet card might be conflicting with another device. Which file should you check within the /proc tree to learn which IRQs are being used by which kernel drivers?
proc/interrupts
The file that you should check within the /proc tree to learn which IRQs are being used by which kernel drivers is /proc/interrupts1 Comprehensive Explanation: The /proc/interrupts file is a virtual file that provides information about the number and type of interrupts per CPU per I/O device12. It displays the IRQ number, the number of that interrupt handled by each CPU core, the interrupt type, and a comma-delimited list of drivers that are registered to receive that interrupt12. For example, the following output shows the contents of /proc/interrupts on a system with two CPUs and several devices:
The first column shows the IRQ number, followed by one column for each CPU core showing the number of interrupts handled by that core. The last column shows the interrupt type and the driver name. Some interrupt types are:
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.
References:
1: 4.3. Interrupts and IRQ Tuning - Red Hat Customer Portal 2: What are the non-numeric IRQs in /proc/interrupts?
Which of the following kernel parameters instructs the kernel to suppress most boot messages?
silent
verbose=0
nomesg
quiet
The quiet kernel parameter instructs the kernel to suppress most boot messages, except for critical errors12. The quiet parameter can be added to the GRUB_CMDLINE_LINUX_DEFAULT variable in the /etc/default/grub file and then run sudo update-grub to apply the changes3. The quiet parameter can also be used in combination with other parameters, such as splash, to enable a graphical boot screen4.
The other options in the question are not valid or do not have the same functionality as the quiet parameter:
References:
1: Getting the Kernel Command-Line Parameters | Baeldung on Linux 2: How to mute kernel messages at startup in Arch Linux? 3: boot - How to turn off the filesystem check message which occures while booting - Ask Ubuntu 4: [How to enable a graphical boot screen on Ubuntu 18.04 LTS - LinuxConfig.org] 5: [Kernel parameters - ArchWiki] : [Linux Kernel Parameters - SysTutorials]
Which of the following options for the kernel's command line changes the systemd boot target to rescue.target instead of the default target?
systemd.target=rescue.target
systemd.runlevel=rescue.target
systemd.service=rescue.target
systemd.default=rescue.target
systemd.unit=rescue.target
During a system boot cycle, what program is executed after the BIOS completes its tasks?
The bootloader
The inetd program
The init program
The kernel
The bootloader is a program that is executed by the BIOS after it completes its tasks of initializing the hardware and performing the POST (Power-On Self Test). The bootloader is responsible for loading the kernel and other necessary files into memory and passing control to the kernel. The bootloader can be either installed in the Master Boot Record (MBR) of the disk or in a separate partition. Some examples of bootloaders are GRUB, LILO, and SYSLINUX. References: LPI Linux Essentials - 1.101.1, LPI Linux Administrator - 102.1
What command changes the nice level of a running process? (Specify ONLY the command without any path or parameters)
renice
The renice command changes the nice level of a running process. The nice level is a value that affects the scheduling priority of a process. A lower nice level means a higher priority and a higher nice level means a lower priority. The renice command requires the process ID (PID) of the target process and the new nice level as arguments. For example, renice -n 10 1234 will change the nice level of the process with PID 1234 to 10. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.3: Perform basic file management, renice command
Which of the following apt-get commands will install the newest versions of all currently installed packages?
auto-update
full-upgrade
dist-upgrade
install
update
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:
Which of the following commands creates an ext3 filesystem on /dev/sdb1? (Choose TWO correct answers.)
/sbin/mke2fs -j /dev/sdb1
/sbin/mkfs -t ext3 /dev/sdb1
/sbin/mkfs -c ext3 /dev/sdb1
/sbin/mke3fs -j /dev/sdb1
The correct commands to create an ext3 filesystem on /dev/sdb1 are /sbin/mke2fs -j /dev/sdb1 and /sbin/mkfs -t ext3 /dev/sdb1. These commands format the partition /dev/sdb1 with the ext3 filesystem type. The first command uses the mke2fs utility with the -j option, which enables journaling. The second command uses the mkfs utility with the -t option, which specifies the filesystem type. Both commands are equivalent and can be used interchangeably. The other options are incorrect because they use the wrong syntax or parameters for the commands. Option C is wrong because the -c option for the mkfs command checks the device for bad blocks, not the filesystem type. Option D is wrong because there is no such utility as mke3fs. The correct utility name is mke2fs.
Which of the following commands is used to change metadata and options for ext3 filesystems?
mod3fs
tune3fs
mod2fs
tune2fs
dump2fs
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/sda1The 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:
After running the command umount /mnt, the following error message is displayed:
umount: /mnt: device is busy.
What is a common reason for this message?
The kernel has not finished flushing disk writes to themounted device.
A user has a file open in the /mnt directory.
Another file system still contains a symlink to a file inside /mnt.
The files in /mnt have been scanned and added to the locate database.
The kernel thinks that a process is about to open a file in /mnt for reading.
One of the common reasons for the error message “device is busy” when trying to unmount a file system is that a user or a process has a file open in the mounted directory. This prevents the kernel from releasing the file system resources and detaching the device. To find out which user or process is holding the file system, one can use the lsof or fuser commands12. For example, lsof /mnt or fuser -m /mnt will list the processes that have open files in /mnt. To force the unmounting of a busy file system, one can use the -l option of the umount command, which will perform a lazy unmount. This means that the file system will be detached as soon as it is not busy anymore3. References: 1: How to solve “device is busy” problem in Linux 2: How to Find Out Which Process Is Using a File in Linux 3: umount(8) - Linux man page
Which type of filesystem is created by mkfs when it is executed with the block device name only and without any additional parameters?
ext2
ext3
ext4
XFS
VFAT
The mkfs command creates a file system on a given device partition. If the type of file system is not specified, the default file system type is ext2. This is mentioned in the man page of mkfs1 and also in the article by How-To Geek2. Ext2 is an older file system that does not support journaling, which is a feature that allows the file system to recover from crashes or power failures. Ext2 is not very commonly used nowadays, as most Linux systems prefer ext4 or other file systems that support journaling and other features. References:
Which signal is sent by the kill command by default?
SIGHUP(1)
SIGQUIT(3)
SIGKILL(9)
SIGTERM(15)
The signal that is sent by the kill command by default is SIGTERM(15). The kill command sends a signal to a process to terminate it. The signal can be specified by name or number as an option to the kill command. If no signal is specified, the default signal is SIGTERM(15), which means terminate. The process can catch this signal and perform any necessary cleanup before exiting. The SIGHUP(1) signal means hang up and is usually sent when the terminal or network connection is disconnected. The SIGQUIT(3) signal means quit and is usually sent when the user presses Ctrl-\ on the keyboard. The SIGKILL(9) signal means kill and is used to force the process to terminate immediately, without any chance to catch the signal or perform any cleanup. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.3: Perform basic file management, kill command, Signal List
Which of the following pieces of information of an existing file is changed when a hard link pointing to that file is created?
File size
Modify timestamp
Link count
Inode number
Permissions
When a hard link pointing to a file is created, the link count of the file is increased by one. The link count is the number of hard links that refer to the same inode. The file size, modify timestamp, inode number and permissions are not affected by creating a hard link. References:
Which of the following commands will print important system information such as the kernel version and machine hardware architecture?
sysinfo
uname
lspci
arch
info
The commands that will print important system information such as the kernel version and machine hardware architecture are uname and arch. The uname command prints system information, such as the kernel name, release, version, machine, processor, hardware platform, and operating system. The arch command prints the machine hardware name, which is equivalent to uname -m. For example, uname -a will print Linux 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux, and arch will print x86_64. The sysinfo command is not a valid Linux command. The lspci command prints information about PCI buses and devices in the system. The info command prints documentation for a given topic or command. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.1: Work on the command line, uname command, arch command, lspci command, info command
Which of the following commands changes the ownership of file.txt to the user dan and the group staff?
chown dan/staff file.txt
chown dan:staff file.txt
chown -u dan -g staff file.txt
chown dan -g staff file.txt
The correct command to change the ownership of file.txt to the user dan and the group staff is chown dan:staff file.txt. This command uses the colon (:) as a separator between the user and the group. The other options are incorrect because they use the wrong syntax or options for the chown command.Option A uses a slash (/) instead of a colon, which is not valid. Option C uses the -u and -g options, which are not supported by the chown command. Option D uses the -g option, which only changes the group, not the user. References:
Which permissions and ownership should the file /etc/passwd have?
-rw-------1 rootroot531 Jun 5 22:45 /etc/passwd
-rw-r--r--1 rootroot531 Jun 5 22:45 /etc/passwd
-rw-r--r--1 11531 Jun 5 22:45 /etc/passwd
-rw-------1 11531 Jun 5 22:45 /etc/passwd
The correct permissions and ownership for the file /etc/passwd are:
B. -rw-r–r-- 1 root root 531 Jun 5 22:45 /etc/passwd
The /etc/passwd file is a plain text-based database that contains information for all user accounts on the system. It is owned by root and has 644 permissions. The file can only be modified by root or users with sudo privileges and readable by all system users. The permissions and ownership of the file are important for the security and functionality of the system. The permissions and ownership of the file can be viewed by using the ls -l command. For example:
ls -l /etc/passwd
The output of the command will show the following information:
-rw-r–r-- 1 root root 531 Jun 5 22:45 /etc/passwd
The first column shows the permissions of the file, which are composed of 10 characters. The first character indicates the file type, which is - for regular files. The next nine characters indicate the permissions for the user (owner), the group, and the others, respectively. Each set of three characters indicates the read ®, write (w), and execute (x) permissions. A dash (-) means no permission. In this case, the permissions are:
The second and third columns show the owner and the group of the file, which are both root. The root user is the superuser or the administrator of the system, who has full access and control over the system. The root group is the primary group of the root user, which usually has no other members.
The fourth column shows the size of the file in bytes, which is 531 in this case. The fifth and sixth columns show the date and time of the last modification of the file, which are Jun 5 22:45 in this case. The last column shows the name of the file, which is /etc/passwd in this case.
The other options are not correct because:
Which command is used to start another command with a given nice level? (Specify ONLY the command without any path or parameters.)
nice
The nice command is used to start another command with a given nice level. The nice level is a value that affects the scheduling priority of a process. A lower nice level means a higher priority, and a higher nice level means a lower priority. The default nice level is 0, and the range is from -20 to 19. Only the superusercan assign a negative nice level to a process. The nice command can also be used to display the current nice level of a process by using the -n option. References:
TESTED 23 Apr 2024