A 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?
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
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
Which command must be entered before exiting vi to save the current file as filea.txt?
%s filea.txt
%w filea.txt
:save filea.txt
:w filea.txt
:s filea.txt
The correct answer is D, :w filea.txt. This command will save the current file as filea.txt before exiting vi. The syntax of the command is:
w [filename]
The colon (:) begins command-input mode, which allows the user to enter commands at the bottom of the screen. The w stands for write, which means to save the file. The filename is the name of the file to be saved. If no filename is given, the command will save the file with the same name as the original file.
Therefore, the command :w filea.txt will save the current file as filea.txt and return to command mode. To exit vi, the user can then enter :q, which stands for quit.
The other commands are incorrect for the following reasons:
%s/pattern/replacement/
The % symbol means to apply the command to the whole file. The s stands for substitute, which means to replace a pattern with another pattern. The pattern is the string to be matched, and the replacement is the string to replace the matched string. However, this command is incomplete, because it does not have a replacement or a delimiter. The command will cause an error and will not save the file.
%w !command
The % symbol means to apply the command to the whole file. The w stands for write, which means to save the file. The ! symbol means to execute an external command. The command is the name of the filter to which the file is written. However, this command is incomplete, because it does not have a ! symbol or a filter name. The command will cause an error and will not save the file.
saveas filename
The saveas command is similar to the write command, but it also changes the current file name to the new file name. However, this command is incorrect, because it does not have the as keyword after save. The command will cause an error and will not save the file.
s/pattern/replacement/
The s stands for substitute, which means to replace a pattern with another pattern. The pattern is the string to be matched, and the replacement is the string to replace the matched string. However, this command is incomplete, because it does not have a replacement or a delimiter. The command will cause an error and will not save the file.
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 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:
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:
Which of the following apt-get subcommands installs the newest versions of all currently installed packages?
auto-update
dist-upgrade
full-upgrade
install
update
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:
Which of the following commands redirects the output of ls to standard error?
ls >-1
ls <
ls >&2
ls >>2
ls |error
This command redirects the output of ls to standard error, which is file descriptor 2 by default. The syntax of the command is:
ls >& file_descriptor
The ls command is a utility that lists the files and directories in the current working directory or a specified directory. The >& symbol is a redirection operator that redirects the standard output of a command to another file descriptor, which can be a file, a device, or another stream. The file_descriptor is the number of the file descriptor to which the output is redirected.
Therefore, the command ls >&2 will run the ls command and redirect its output to file descriptor 2, which is standard error. This means that the output of ls will not be displayed on the screen, but sent to the standard error stream, which can be used for error handling or logging purposes.
The other commands are incorrect for the following reasons:
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 is true when a file system, which is neither listed in /etc/fstab nor known to system, is mounted manually?
systemd ignores any manual mounts which are not done using the systemctl mount command
The command systemctl mountsync can be used to create a mount unit based on the existing mount
systemd automatically generates a mount unit and monitors the mount point without changing it
Unless a systemd mount unit is created, systemd unmounts the file system after a short period of time
systemctl unmount must be used to remove the mount because system opens a file descriptor on the mount point
Systemd is a system and service manager for Linux systems, and it can manage the mounting and unmounting of file systems. Systemd can automatically create and start mount units for file systems that are listed in /etc/fstab or are known to the system. Mount units are unit files that encode information about a file system mount point controlled and supervised by systemd. Mount units must be named after the mount point directories they control, and they have the suffix .mount. For example, the mount point /home must be configured in a unit file home.mount.
Systemd can also handle file systems that are neither listed in /etc/fstab nor known to the system, but are mounted manually by the user. In this case, systemd automatically generates a transient mount unit and monitors the mount point without changing it. A transient mount unit is a unit that is created dynamically and temporarily, and is not backed by a unit file on disk. A transient mount unit has the same name and properties as a regular mount unit, but it is not persistent across reboots. Systemd does not interfere with the manual mount, and does not unmount it unless explicitly requested by the user. The user can use the mount command or the systemd-mount command to create a manual mount, and the umount command or the systemd-umount command to remove it. The user can also use the systemctl command to inspect and control the transient mount unit. For example, to show the status of the transient mount unit for the mount point /mnt, use the following command:
systemctl status mnt.mount
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:
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:
Which wildcards will match the following filenames? (Choose two.)
ttyS0
ttyS1
ttyS2
ttyS[1-5]
tty?[0-5]
tty*2
tty[A-Z][012]
tty[Ss][02]
[character list] matches any one of the characters in the list. ? matches any single character. * matches any number of characters, including none.
Therefore, the wildcard ttyS[1-5] will match any filename that starts with ttyS and ends with a digit from 1 to 5, such as ttyS1, ttyS2, ttyS3, ttyS4, or ttyS5. However, it will not match ttyS0, which has a 0 at the end.
The wildcard tty?[0-5] will match any filename that starts with tty, followed by any single character, followed by a digit from 0 to 5, such as ttyS0, ttyS1, ttyS2, ttyA0, ttyB5, or ttyZ4. This wildcard will match all the given filenames.
The wildcard tty*2 will match any filename that starts with tty and ends with 2, such as ttyS2, ttyA2, ttyB2, or ttyZZZ2. This wildcard will match ttyS2, but not the other two filenames.
The wildcard tty[A-Z][012] will match any filename that starts with tty, followed by a capital letter from A to Z, followed by a digit from 0 to 2, such as ttyA0, ttyB1, ttyC2, ttyZ0, or ttyZ2. This wildcard will match ttyS0 and ttyS2, but not ttyS1, which has a 1 at the end.
The wildcard tty[Ss][02] will match any filename that starts with tty, followed by either S or s, followed by either 0 or 2, such as ttyS0, ttyS2, ttys0, or ttys2. This wildcard will match ttyS0 and ttyS2, but not ttyS1, which has a 1 at the end.
Which 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 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:
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 of the following examples for Bash file globbing matches a file named root-can-do-this.txt when used in the directory holding that file? (Choose three correct answers.)
root*can?do-this.{txt,odt}
r[oOoO]t-can-do*.txt
{root,user,admin}-can-??-this.txt
root*can*do??this.txt
root***{can,may}-do-this.[tT][xX][tT]
The examples for Bash file globbing that match a file named root-can-do-this.txt are:
The examples that do not match are:
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 file from the /proc file system contains a list of all currently mounted devices? (Specify ONLY the command without any path or parameters.)
mounts
The file /proc/mounts contains a list of all currently mounted devices in the system. It is a pseudo-file that is dynamically generated by the kernel and reflects the actual state of the mount table. It has a similar format to /etc/fstab, but shows the actual mount options and file system types used by the kernel. The file/proc/mounts can be read by any user, but only the root user can modify it. The file /proc/mounts is also known as /proc/self/mounts, which is a symbolic link to the mounts file for the current process. References:
Which of the following commands converts spaces in a file to tab characters and prints the result to standard output?
iconv
expand
unexpand
tab
The unexpand command converts spaces in a file to tab characters and prints the result to standard output. It can take an option -t to specify the number of spaces per tab, otherwise it uses the default value of 8. Theunexpand command is the opposite of the expand command, which converts tabs to spaces. Both commands are useful for formatting text files according to different coding standards or preferences. References:
Which of the following commands print the current working directory when using a Bash shell? (Choose two.)
echo “${PWD}”
echo “${WD}”
pwd
printwd
echo “${pwd}”
PWD”,C.pwd∗∗ComprehensiveExplanation:∗∗ThecommandsthatwillprintthecurrentworkingdirectorywhenusingaBashshellareecho“{PWD}” and pwd. The echo command will print the value of the PWD variable, which is set by the shell to the current working directory. The pwd command will print the name of the current working directory. The WD variable is not a standard shell variable and may not be defined. The printwd command is not a valid Linux command. The pwd variable is not the same as the PWD variable and may not be defined.References:LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.1: Work on the command line, echo command, pwd command
Which of the following is the device file name for the second partition on the only SCSI drive?
/dev/hda1
/dev/sda2
/dev/sd0a2
/dev/sd1p2
The correct device file name for the second partition on the only SCSI drive is /dev/sda2. This is because SCSI drives use the naming scheme sdX, where X is a letter starting from a for the first drive, b for the second drive, and so on. The partitions on each drive are numbered from 1 to the maximum number of partitions supported by the drive. Therefore, the first partition on the first SCSI drive is /dev/sda1, the second partition on the first SCSI drive is /dev/sda2, the first partition on the second SCSI drive is /dev/sdb1, and so on. The other options are incorrect because they do not follow the SCSI naming scheme. Option A is wrong because it uses the naming scheme for IDE drives, which is hdX. Option C is wrong because it uses the naming scheme for BSD drives, which is sdXaY, where X is a number and Y is a letter. Option D is wrong because it uses the naming scheme for Solaris drives, which is sdXpY, where X is a number and Y is a number. References:
Which of the following file permissions belong to a symbolic link?
-rwxrwxrwx
+rwxrwxrwx
lrwxrwxrwx
srwxrwxrwx
The correct file permissions that belong to a symbolic link are lrwxrwxrwx. This is because a symbolic link is a special file that points to another file or directory. The first character of the file permissions indicates the file type. The letter l means that the file is a symbolic link. The other letters r, w, and x represent the read, write, and execute permissions for the owner, group, and others classes. However, the permissions of the symbolic link are not used for accessing the file or directory that it points to. The permissions of the target file or directory are used instead. Therefore, the permissions of the symbolic link are usually set to rwx for all classes, meaning that anyone can read, write, or execute the link. The other options are incorrect because they do not indicate the file type of a symbolic link. Option A is wrong because the first character - means that the file is a regular file, not a symbolic link. Option B is wrong because the first character + is not a valid file type indicator. Option D is wrong because the first character s means that the file is a socket, not a symbolic link. References:
What do the permissions -rwSr-xr-x mean for a binary file when it is executed as a command?
The command is SetUID and it will be executed with the effective rights of the owner.
The command will be executed with the effective rights of the group instead of the owner.
The execute flag is not set for the owner. Therefore, the SetUID flag is ignored.
The command will be executed with the effective rights of the owner and group.
The permissions -rwSr-xr-x mean that the file is readable and writable by the owner, readable and executable by the group, and readable and executable by others. The S in the owner’s permissions indicates that the file has the SetUID bit set, which means that when the file is executed as a command, it will run with the effective user ID of the file owner, rather than the user who executed it. This allows the command to perform privileged operations that the user normally cannot do. For example, the /bin/passwd commandhas the SetUID bit set, so that it can modify the /etc/shadow file, which is only writable by root. References: LPI Linux Administrator, File Permissions and Attributes
The system configuration file named _______ is commonly used to set the default runlevel. (Please provide the file name with full path information)
/etc/inittab
The system configuration file named /etc/inittab is commonly used to set the default runlevel. This file contains information about the initialization process of the system, and it defines the default runlevel, the available runlevels, and the actions to be taken when entering or leaving a runlevel. The default runlevel is the mode of operation that the system starts up into, and it determines which services and processes are running. The default runlevel is specified by a line similar to the following in the /etc/inittab file:
id:5:initdefault:
The number after the first colon indicates the default runlevel, which can range from 0 to 6. The meaning of each runlevel is:
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.
References:
Which utility would be used to change how often a filesystem check is performed on an ext2 filesystem without losing any data stored on that filesystem?
mod2fs
fsck
tune2fs
mke2fs
fixe2fs
The utility that can be used to change how often a filesystem check is performed on an ext2 filesystem without losing any data stored on that filesystem is tune2fs. This command can adjust various parameters of a Linux ext2, ext3, or ext4 filesystem, such as the maximum mount count, the check interval, the reserved blocks percentage, and the default mount options. To change the check interval, the -i option can be used, followed by a time value. For example, to set the check interval to 180 days for the filesystem on /dev/sda1, the following command can be used:
sudo tune2fs -i 180d /dev/sda1
This command will modify the superblock of the filesystem, which contains the metadata and configuration information, without affecting the data stored on the filesystem. The other options are incorrect because they are not suitable for changing the check interval of an ext2 filesystem. Option A is wrong because there is no such utility as mod2fs. Option B is wrong because fsck is a utility for checking and repairing filesystems, not changing their parameters. Option D is wrong because mke2fs is a utility for creating ext2 filesystems, which will erase the existing data on the partition. Option E is wrong because there is no such utility as fixe2fs.
For more information on how to use the tune2fs command, you can refer to the following articles:
Which chown command will change the ownership to dave and the group to staff on a file named data.txt?
chown dave/staff data.txt
chown –u dave –g staff data.txt
chown --user dave --group staff data.txt
chown dave:staff data.txt
The chown command is used to change the owner and group of files and directories in Linux. The basic syntax of the chown command is:
chown [options] user[:group] file…
The user is the name or the numeric ID of the new owner of the file. The group is the name or the numeric ID of the new group of the file. The file is the name or the path of the file or directory to be changed. The user and group are separated by a colon (:), not a slash (/). The group is optional, and if it is omitted, the group will not be changed. The options are optional, and they can modify the behavior of the chown command, such as changing the ownership recursively, silently, or verbosely.
In this question, the user is dave and the group is staff. The file is data.txt. Therefore, the correct command to change the ownership to dave and the group to staff on data.txt is:
chown dave:staff data.txt
This command will change the owner of data.txt to dave and the group of data.txt to staff. You can verify the changes by using the ls -l command to view the owner and group of data.txt.
The other options are not correct because:
chown: invalid user: ‘dave/staff’
chown: invalid option – ‘u’ Try ‘chown --help’ for more information.
chown: unrecognized option ‘–user’ Try ‘chown --help’ for more information.
References:
Which of the following commands can be used to search for the executable file foo when it has been placed in a directory not included in $PATH?
apropos
which
find
query
whereis
The correct command to search for the executable file foo when it has been placed in a directory not included in $PATH is find. The find command can search for files and directories based on various criteria, such as name, type, size, permissions, ownership, and more. To find the executable file foo, you can use the following command:
find / -type f -executable -name foo
This command will search the entire filesystem (/) for regular files (-type f) that are executable (-executable) and have the name foo (-name foo). The other commands are not suitable for this task. The apropos command searches the manual page names and descriptions for a keyword. The which command shows the full path of a command that is in the $PATH variable. The query command is not a standard Linux command. The whereis command locates the binary, source, and manual page files for a command, but only in the standard Linux directories. References:
In compliance with the FHS, in which of the following directories are documentation files found?
/usr/share/documentation
/usr/local/share/documentation
/var/share/doc
/usr/share/doc
/etc/share/doc
According to the FHS (Filesystem Hierarchy Standard), the /usr/share/doc directory is used to store documentation files for various packages installed on the system. The documentation files may include README files, manuals, license agreements, changelogs, etc. The /usr/share/doc directory is intended to be read-only and independent of the machine architecture. The other directories are not compliant with the FHS or do not exist by default. The /usr/share/documentation directory is not a standard directory and may not be recognized by some applications. The /usr/local/share/documentation directory is also not a standard directory and may conflict with the /usr/local/share/doc directory, which is used for documentation files for locally installed packages. The /var/share/doc directory does not exist by default and is not a valid subdirectory of /var, which is used for variable data files. The /etc/share/doc directory does not exist by default and is not a valid subdirectory of /etc, which is used for configuration files. References:
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?
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.
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:
Which file in /proc describes the IRQs that are used by various kernel drivers? (Specify the file name only without any path.)
interrupts
Which of the following commands will reduce all consecutive spaces down to a single space?
tr '\s' ' ' < a.txt > b.txt
tr -c ' ' < a.txt > b.txt
tr -d ' ' < a.txt > b.txt
tr -r ' ' '\n' < a.txt > b.txt
tr -s ' ' < a.txt > b.txt
The command that will reduce all consecutive spaces down to a single space is tr -s ’ ’ < a.txt > b.txt. This command uses the following options and syntax:
The output of this command will be a new file called b.txt that contains the same text as a.txt, except that any sequence of multiple spaces will be replaced by a single space. For example, if the file a.txt contains the following text:
This is a text file with multiple spaces.
The file b.txt will contain the following text:
This is a text file with multiple spaces.
The other commands are incorrect for the following reasons:
References:
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 commands will send output from the program myapp to both standard output (stdout) and the file file1.log?
cat < myapp | cat > file1.log
myapp 0>&1 | cat > file1.log
myapp | cat > file1.log
myapp | tee file1.log
tee myapp file1.log
The tee command reads from standard input and writes to both standard output and one or more files1. Therefore, the command myapp | tee file1.log will send the output of the program myapp to both the terminal and the file file1.log. The other commands will either fail to write to both standard output and file, or write the wrong output. For example, the command cat < myapp | cat > file1.log will try to read the file myapp as input and write it to the file file1.log, but it will not display anything on the terminal. The command myapp 0>&1 | cat > file1.log will redirect the standard input of myapp to its standard output, and then pipe it to the file file1.log, but it will not display anything on the terminal. The command myapp | cat > file1.log will pipe the output of myapp to the file file1.log, but it will not display anything on the terminal. The command tee myapp file1.log will try to read from standard input and write to both the file myapp and the file file1.log, but it will not execute the program myapp. References:
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 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 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:
Which shell command is used to continue background execution of a suspended command?
&
bg
cont
exec
:&
The bg command is used to resume a suspended command in the background, allowing it to run without user interaction. The command takes a job ID as an argument, which can be obtained by using the jobs command. Alternatively, if no job ID is specified, bg will resume the most recently suspended job. The bg command is part of the job control features of the Linux shell, which allow users to manage multiple processes running in the same terminal. References:
Which of the following commands moves and resumes in the background the last stopped shell job?
run
bg
fg
back
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:
In compliance with the FHS, in which of the directories are man pages found?
/usr/share/man
/opt/man
/usr/doc/
/var/pkg/man
/var/man
According to the Filesystem Hierarchy Standard (FHS), the directory /usr/share/man contains manual pages for user commands, system calls, library functions, and other documentation1. The other directories are either non-standard, deprecated, or used for different purposes. For example, /opt/man is used for manual pages for add-on application software packages1, /usr/doc/ is an old location for documentation files that is no longer used2, /var/pkg/man and /var/man are not defined by the FHS. References:
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 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:
Which of the following commands will print the last 10 lines of a text file to the standard output?
cat -n 10 filename
dump -n 10 filename
head -n 10 filename
tail -n 10 filename
The tail command prints the last part of a file to the standard output. The -n option specifies the number of lines to print. Therefore, tail -n 10 filename will print the last 10 lines of the file named filename. The other commands are either invalid or do not perform the desired task. The cat command concatenates files and prints them to the standard output, but it does not have a -n option. The dump command is used to backup filesystems, not to print files. The head command prints the first part of a file, not the last part. References:
Which of the following commands prints all files and directories within the /tmp directory or its subdirectories which are also owned by the user root? (Choose TWO correct answers.)
find /tmp -uid root -print
find -path /tmp -uid root
find /tmp -user root -print
find /tmp -user root
find -path /tmp -user root –print
The find command is used to search for files and directories that match certain criteria. The -uid option specifies the numeric user ID of the owner of the file or directory, while the -user option specifies the name of the owner. The -print option prints the full file name of the matching file or directory to the standard output. Therefore, both find /tmp -uid root -print and find /tmp -user root -print will print all files and directories within the /tmp directory or its subdirectories which are also owned by the user root. The other options are either invalid or do not perform the desired task. The -path option matches the whole path name, not just the starting directory. The -print option is implied if no other action is specified, but it is good practice to include it for clarity. References:
Which command displays a list of all background tasks running in the current shell? (Specify ONLY the command without any path or parameters.)
jobs
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 www.howtogeek.com).
1- Running sleep 10 & 2+ Stopped ping www.howtogeek.com
References:
While editing a file in vi, the file changes due to another process. Without exiting vi, how can the file be reopened for editing with the new content?
:r
:n
:w
:e
The :e command in vi is used to edit a file. If the file name is not specified, it will edit the current file. If the file has been changed by another process, the :e command will reload the file with the new content, discarding any unsaved changes made in vi. Therefore, the :e command can be used to reopen the file for editing with the new content without exiting vi. The other options are either invalid or do not perform the desired task. The :r command is used to read the content of another file or command and insert it into the current file. The :n command is used to edit the next file in the argument list, if any. The :w command is used to write the current file to disk, optionally with a new name. 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:
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.)
dpkg-reconfigure
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:
Which of the following commands is used to update the list of available packages when using dpkg based package management?
apt-get update
apt-get upgrade
apt-cache update
apt-get refresh
apt-cache upgrade
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:
References:
1: How To Manage Packages Using apt-get, apt-cache, apt-file and dpkg Commands In Debian Based Systems 2: Ubuntu Manpage: apt-get - APT package handling utility – command-line interface 3: dpkg - Debian Wiki 4: Ubuntu Manpage: apt-cache - query the APT cache
What is the difference between the --remove and the --purge action with the dpkg command?
--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
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:
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?
auto-update
upgrade
dist-upgrade
install
update
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:
Which option to the yum command will update the entire system? (Specify ONLY the option name without any additional parameters.)
update/upgrade
The yum command is a tool for managing software packages on Red Hat Enterprise Linux and other RPM-based systems. The yum update option will update the entire system by checking the versions of the installed packages and installing the latest available versions from the repositories. The yum upgrade option will do the same, but it will also remove any obsolete packages that are no longer needed by the system. Both options will prompt the user to confirm before proceeding with the update or upgrade process. References:
Which of the following commands lists all currently installed packages when using RPM package management?
yum --query --all
yum --list --installed
rpm --query --all
rpm --list –installed
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 itlists 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.
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:
In which directory must definition files be placed to add additional repositories to yum?
B
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 baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
References:
Which RPM command will output the name of the package which supplied the file /etc/exports?
rpm -F /etc/exports
rpm -qf /etc/exports
rpm -Kl /etc/exports
rpm -qp /etc/exports
rpm -qi/etc/exports
The RPM command that will output the name of the package which supplied the file /etc/exports is rpm -qf /etc/exports. This command will query the RPM database and find the package that owns or provides the file /etc/exports1. The output will show the package name, version, release, and architecture. For example:
The other options are incorrect for the following reasons:
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 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:
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:
What is the name of the main configuration file for GNU GRUB? (Specify the file name only without any path.)
C
The main configuration file for GNU GRUB is grub.cfg, which is usually located in /boot/grub/ or /boot/grub2/ depending on the distribution. This file contains the menu entries for the boot loader, each with a title, a kernel image, an initrd image, and optional parameters. The grub.cfg file is not meant to be edited manually, as it is generated by the grub-mkconfig command, which reads the settings from /etc/default/grub and the scripts in /etc/grub.d/. The /etc/default/grub file contains the global options for GRUB, such as the default menu entry, the timeout, the theme, etc. The /etc/grub.d/ directory contains executable scripts that are run by grub-mkconfig to generate the menu entries for each operating system or kernel found on the system. For example, the script 10_linux generates the entries for the Linux kernels installed by the package manager, while the script 30_os-prober generates the entries for other operating systems detected on the system, such as Windows. To make changes to the GRUB configuration, one should edit the /etc/default/grub file and/or the scripts in /etc/grub.d/, and then run grub-mkconfig -o /boot/grub/grub.cfg to update the grub.cfg file. References:
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:
The USB device filesystem can be found under /proc/______/usb/. (Please fill in the blank with the single word only)
bus
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 .
References:
1: USB in a NutShell - Chapter 5 - Linux USB 2: Linux USB FAQ 3: Alternative to /proc/bus/usb/devices - Super User : [What is the difference between /dev/usb, /proc/bus/usb and /sys/bus/usb? - Super User]
Which of the following statements is correct when talking about /proc/?
All changes to files in /proc/ are stored in /etc/proc.d/ and restored on reboot.
All files within /proc/ are read-only and their contents cannot be changed.
All changes to files in /proc/ are immediately recognized by the kernel.
All files within /proc/ are only readable by the root user.
The /proc/ directory is a virtual filesystem that provides a view of the kernel’s data structures and parameters. It contains information about processes, hardware, memory, modules, and other aspects of thesystem. 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 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 of the following information is stored within the BIOS? (Choose TWO correct answers.)
Boot device order
Linux kernel version
Timezone
Hardware configuration
The system's hostname
The BIOS (Basic Input/Output System) is a firmware that is stored in a ROM chip on the motherboard and is responsible for initializing the hardware and loading the bootloader. The BIOS has a setup utility that allows the user to configure various settings, such as the boot device order, the hardware configuration, the system date and time, the security options, etc. The BIOS does not store information about the Linux kernel version, the time zone, or the system’s hostname, as these are part of the operating system and are not relevant for the BIOS. References: LPI Linux Essentials - 1.101.1, LPI Linux Administrator - 102.1
Which of the following options for the kernel's command line changes the systemd boot target to rescue.target instead of the default target?
systemd.target=rescue.target
systemd.runlevel=rescue.target
systemd.service=rescue.target
systemd.default=rescue.target
systemd.unit=rescue.target
Which of the following are init systems used within Linux systems? (Choose THREE correct answers.)
startd
systemd
Upstart
SysInit
SysV init
systemd, Upstart, and SysV init are all init systems used within Linux systems. An init system is the first process executed by the kernel at boot time, which has a process ID (PID) of 1, and is responsible for starting and managing all other processes on the system. Different init systems have different features, advantages, and disadvantages. Some of the most common init systems are:
References: 1: 6 Best Modern Linux ‘init’ Systems (1992-2023) - Tecmint 2: 10 Best Linux init systems as of 2023 - Slant.
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 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 command will display messages from the kernel that were output during the normal boot sequence?
dmesg
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:
Which command displays the contents of the Kernel Ring Buffer on the command line? (Provide only the command name without any options or path information)
dmesg,
The command that displays the contents of the Kernel Ring Buffer on the command line is dmesg12. The dmesg command is a Linux utility that displays kernel-related messages retrieved from the kernel ring buffer12. The ring buffer stores information about hardware, device driver initialization, and messages fromkernel 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
References:
1: dmesg Linux Command {Syntax, Options and Examples} - phoenixNAP 2: Ubuntu Manpage: dmesg - print or control the kernel ring buffer 3: Display Recent Kernel Messages (console, kernel ring buffer, facilities)
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
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
Copyright © 2014-2024 Certensure. All Rights Reserved