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 of the following options is used in a GRUB Legacy configuration file to define the amount of time that the GRUB menu will be shown to the user?
hidemenu
splash
timeout
showmenu
The timeout option in a GRUB Legacy configuration file is used to define the amount of time (in seconds) that the GRUB menu will be shown to the user before booting the default entry. The timeout option is usually located in the /boot/grub/menu.lst file. For example, timeout 10 will display the GRUB menu for 10 seconds. To disable the timeout and wait for user input indefinitely, the value of timeout can be set to -1. To boot immediately without displaying the menu, the value of timeout can be set to 0. The other options are not valid for the GRUB Legacy configuration file. References:
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
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:
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:
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 enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
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 lists the dependencies of a given dpkg package?
apt-cache depends-onpackage
apt-cache dependencies package
apt-cache depends package
apt-cache requires package
The apt-cache command is used to query the APT cache for information about packages. The depends option shows a listing of each dependency a package has and all the possible other packages that can fulfill that dependency. For example, apt-cache depends ubuntu-restricted-extras will show the dependencies of the ubuntu-restricted-extras package. The other options are not valid for the apt-cache command. References:
What can the Logical Volume Manager (LVM) be used for? (Choose THREE correct answers.)
To create RAID 9 arrays.
To dynamically change the size of logical volumes.
To encrypt logical volumes.
To create snapshots.
To dynamically create or delete logical volumes.
The Logical Volume Manager (LVM) is a tool that allows the creation and management of logical volumes on Linux systems. Logical volumes are partitions that can span multiple physical disks and can be resized or deleted without affecting the rest of the system. Some of the benefits of using LVM are:
LVM cannot be used for the following purposes:
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:
After modifying GNU GRUB's configuration file, which command must be run for the changes to take effect?
kill -HUP $(pidof grub)
grub-install
grub
No action is required
After modifying GNU GRUB’s configuration file, which is usually located at /etc/default/grub, the command that must be run for the changes to take effect is grub-install12. The grub-install command is used to install GRUB on a device or partition, and to update the boot sector and the core image of GRUB3. The command takes the following basic syntax:
$ grub-install [options] install_device
The install_device argument specifies the device or partition where GRUB should be installed, such as /dev/sda or /dev/sda1. The options can be used to control various aspects of the installation, such as the target platform, the boot directory, the force mode, the verbosity level, etc3.
The grub-install command also invokes the grub-mkconfig command, which generates the GRUB configuration file (usually located at /boot/grub/grub.cfg) based on the settings in /etc/default/grub and the scripts in /etc/grub.d4. The grub-mkconfig command can also be run separately to update the GRUB configuration file without reinstalling GRUB on the device or partition4.
The other options in the question are not correct because:
References:
1: How to Update Grub on Ubuntu and Other Linux Distributions - It’s FOSS 2: How to Configure the GRUB2 Boot Loader’s Settings 3: Ubuntu Manpage: grub-install - install GRUB on a device 4: [GNU GRUB Manual 2.06: Invoking grub-mkconfig] : [GNU GRUB Manual 2.06: Invoking grub] : [kill(1) - Linux manual page] : [pidof(8) - Linux manual page] : [grub(8) - Linux manual page]
You want to preview where the package file, apache-xml.i386.rpm, will install its files before installing it. What command do you issue?
rpm -qp apache-xml.i386.rpm
rpm -qv apache-xml.i386.rpm
rpm -ql apache-xml.i386.rpm
rpm -qpl apache-xml.i386.rpm
To prevent users from being able to fill up the / partition, the ____________ directory should be on a separate partition if possible because it is world writeable.
/tmp
tmp
The /tmp directory should be on a separate partition if possible because it is world writable. This means that any user can create, modify, or delete files and directories in /tmp. This can pose a risk of filling up the / partition, which can cause system instability or failure. By having /tmp on a separate partition, we can limit the amount of disk space that can be used by temporary files and prevent users from affecting the / partition. The /tmp directory is also a common target for malicious attacks, so having it on a separate partition can improve the security and isolation of the system. The /tmp directory is one of the few directories that are world writable by default, according to the Filesystem Hierarchy Standard (FHS)1. The other directories that are usually world writable are /var/tmp and /var/lock, which are also used for temporary or lock files. However, these directories are not as frequently used or as large as /tmp, so they are less likely to fill up the / partition. The /tmp directory also has the sticky bit set, which means that only the owner of a file or directory can delete or rename it2. This prevents users from deleting or modifying other users’ files in /tmp. However, this does not prevent users from creating new files or directories in /tmp, which can still consume disk space and resources. Therefore, it is advisable to have /tmp on a separate partition if possible. References:
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:
Which command will disable swapping on a device? (Specify ONLY the command without any path or parameters.)
A
The swapoff command is used to disable swapping on a device or a file. It takes the path of the device or file as an argument, or -a to disable all swaps. Disabling swap can improve the performance of the system if there is enough physical memory, or it can be necessary if the swap size needs to be changed. However, disabling swap can also cause problems if the system runs out of memory and has no swap space to use. References:
When redirecting the output of find to the xargs command, what option to find is useful if the filenames contain spaces?
–rep-space
-printnul
-nospace
–ignore-space
–print0
This option to the find command is useful if the filenames contain spaces when redirecting the output of find to the xargs command. The syntax of the option is:
find [where to start searching from] [expression determines what to find] -print0
The -print0 option tells the find command to print the full file name on the standard output, followed by a null character (ASCII code 0) instead of the newline character. This allows file names that contain spaces or other special characters to be correctly interpreted by the xargs command, which can use the -0 option to read items from the standard input that are terminated by a null character. The syntax of the xargs command with the -0 option is:
xargs -0 [command]
The -0 option tells the xargs command to expect the items from the standard input to be separated by a null character, and to execute the command using the items as arguments.
Therefore, the command find … -print0 | xargs -0 … will search for files and directories using the find command, print the results with a null character as the separator, pipe the output to the xargs command, which will read the items with a null character as the separator, and execute another command using the items as arguments. This will avoid any problems with filenames that contain spaces or other special characters.
The other options are incorrect for the following reasons:
References:
A Debian package creates several files during its installation. Which of the following commands searches for packages owning the file /etc/debian_version?
apt-get search /etc/debian_version
apt –r /etc/debian_version
find /etc/debian_version -dpkg
dpkg –S /etc/debian_version
apt-file /etc/debian_version
The command that searches for packages owning the file /etc/debian_version is dpkg –S /etc/debian_version. The dpkg command is the low-level tool for installing, removing, configuring, and querying Debian packages. The -S or --search option takes a file name or a pattern as an argument and searches for the packages that contain the matching files. The output shows the package name and the file name separated by a colon. For example, running dpkg -S /etc/debian_version will produce the output base-files:/etc/debian_version, indicating that the file /etc/debian_version belongs to the base-files package. The other commands are either invalid or do not perform the desired task. The apt-get command is used to download and install packages from the Debian repositories, but it does not have a search option. The aptcommand is a high-level tool for managing packages, but it does not have a -r option. The find command is used to search for files in the file system, but it does not have a -dpkg option. The apt-file command is used to search for files in the packages available in the Debian repositories, but it requires a subcommand such as search or show before the file name or pattern. 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:
Which command displays the current disk space usage for all mounted file systems? (Specify ONLY the command without any path or parameters.)
df
The command df displays the current disk space usage for all mounted file systems. It shows the size, used space, available space, percentage of usage, and mount point of each file system. By default, the output is in 1K blocks, but it can be changed with options like -h (human-readable), -B (block size), -i (inodes), and -T (type). The command df is part of the 101.1 Determine and configure hardware settings topic of the LPI Linux Essentials certification program12. References:
What output will be displayed when the user fred executes the following command?
echo ‘fred $USER’
fred fred
fred /home/fred/
‘fred $USER’
fred $USER
‘fred fred’
This output will be displayed when the user fred executes the following command:
echo 'fred $USER'
The echo command is a built-in Linux feature that prints out arguments as the standard output. The syntax of the echo command is:
echo [option] [string]
The option can modify the behavior of the echo command, such as enabling the interpretation of escape characters or omitting the newline after the output. The string is the text that is displayed as the output.
The single quotation marks (’ ') are used to enclose the string argument and prevent any expansion or substitution of the characters inside the quotation marks. This means that any variables, commands, or special characters inside the single quotation marks are treated as literal characters, not as expressions.
The $USER variable is a shell variable that holds the username of the current user. However, since it is enclosed in single quotation marks, it is not expanded to its value, but printed as it is.
Therefore, the command echo ‘fred $USER’ will print the string fred $USER as the output, without any changes. The output will be the same for any user who executes the command, not just fred.
The other outputs are incorrect for the following reasons:
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:
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 program runs a command in specific intervals and refreshes the display of the program’s output? (Specify ONLY the command without any path or parameters.)
watch
The program that runs a command in specific intervals and refreshes the display of the program’s output is watch. This command is used to run any designated command at regular intervals and displays the output of the command on the terminal window. It is useful when you have to execute a command repeatedly and watch the command output change over time. The syntax of the watch command is:
watch [options] command
The options can modify the behavior of the watch command, such as how to format the output, how to handle signals, or how to enable color. The command is the command that you want to run and monitor. The default interval between each execution of the command is 2 seconds, but you can change it with the -n or --interval option. For more help using the watch command and its options, run man watch or visit this link.
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:
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:
Given the following input stream:
txt1.txt
atxt.txt
txtB.txt
Which of the following regular expressions turns this input stream into the following output stream?
txt1.bak.txt
atxt.bak.txt
txtB.bak.txt
s/^.txt/.bak/
s/txt/bak.txt/
s/txt$/bak.txt/
s/^txt$/.bak^/
s/[.txt]/.bak$1/
The correct answer is C, s/txt$/bak.txt/. This regular expression will turn the input stream into the desired output stream by using the s command, which is used to substitute or replace a pattern with another pattern. The syntax of the s command is:
s/pattern/replacement/
The pattern is the regular expression that matches the text to be replaced, and the replacement is the text that replaces the matched text. The / symbol is used as a delimiter to separate the pattern and the replacement, but other characters can be used as well.
The pattern in this regular expression is txt$, which means that it will match the string txt at the end of the line. The $ symbol is an anchor that matches the end of the line. The replacement in this regular expression is bak.txt, which means that it will replace the matched string with the string bak.txt.
Therefore, the command s/txt$/bak.txt/ will replace the string txt at the end of each line with the string bak.txt, resulting in the following output stream:
txt1.bak.txt atxt.bak.txt txtB.bak.txt
The other regular expressions are incorrect for the following reasons:
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 commands changes all CR-LF line breaks in the text file userlist.txt to Linux standard LF line breaks and stores the result in newlist.txt?
tr –d ‘\r’ < userlist.txt > newlist.txt
tr –c ‘\n\r’ ‘’
tr ‘\r\n’ ‘’
tr ‘\r’ ‘\n’ userlist.txt newlist.txt
tr –s ‘/^M/^J/’ userlist.txt newlist.txt
The correct answer is A, tr -d ‘\r’ < userlist.txt > newlist.txt. This command will use the tr utility to delete the carriage return characters (\r) from the userlist.txt file and redirect the output to the newlist.txt file. The tr utility is used to translate, delete, or squeeze characters from the standard input and write the result to the standard output. The syntax of the tr command is:
tr [options] set1 [set2]
The options can modify the behavior of the tr command, such as complementing, squeezing, or truncating the sets of characters. The set1 and set2 are strings of characters that specify the translation to be performed. The characters in set1 are replaced by the corresponding characters in set2. If set2 is omitted, the characters in set1 are deleted.
The -d option tells tr to delete the characters in set1 from the output. The \r character is a special escape sequence that represents the carriage return character, which is used in Windows systems to mark the end of a line, along with the line feed character (\n). The < and > symbols are redirection operators that redirect the input and output of a command to a file or device. The < symbol redirects the standard input of a command from a file, while the > symbol redirects the standard output of a command to a file, overwriting any existing content.
Therefore, the command tr -d ‘\r’ < userlist.txt > newlist.txt will read each character from the userlist.txt file, delete any carriage return characters, and write the output to the newlist.txt file. This will effectively change all CR-LF line breaks (\r\n) in the userlist.txt file to Linux standard LF line breaks (\n) and store the result in newlist.txt.
The other commands are incorrect for the following reasons:
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:
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 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
1- Running sleep 10 & 2+ Stopped ping
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 is the difference between the i and a command of the vi editor?
i (interactive) requires the user to explicitly switch between vi modes whereas a (automatic) switches modes automatically.
i (insert) inserts text before the current cursor position whereas a (append) inserts text after the cursor.
i (independent rows) starts every new line at the first character whereas a (aligned rows) keeps the indentation of the previous line.
i (interrupt) temporarily suspends editing of a file to the background whereas a (abort) terminates editing.
The i and a commands are two of the most commonly used commands in the vi editor to enter the insert mode. The insert mode allows the user to insert text into the file. The difference between the i and a commands is that the i command inserts text before the current cursor position, while the a command inserts text after the cursor position. For example, if the cursor is on the letter “e” in the word “editor”, then pressing i will allow the user to insert text before the “e”, while pressing a will allow the user to insert text after the “e”. The user can exit the insert mode by pressing the Esc key, which will return to the command mode. References:
You are trying to make a hard link to an ordinary file but ln returns an error. Which of the following could cause this?
The source file is hidden.
The source file is read-only.
The source file is a shell script.
You do not own the source file.
The source and the target are on different filesystems.
A hard link is a directory entry that refers to the same inode as another file. An inode is a data structure that stores the metadata and the location of the data blocks of a file. A hard link allows multiple names to refer to the same file content, as long as they are on the same filesystem. However, if the source and the target of the hard link are on different filesystems, the ln command will return an error, because the inode numbers are not consistent across different filesystems. Therefore, the ln command cannot create a hard link that crosses filesystem boundaries. The other options are either incorrect or not applicable. The source file being hidden, read-only, a shell script, or not owned by the user does not prevent the creation of a hard link, as long as the user has the permission to write to the target directory and the source and the target are on the same filesystem. References:
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:
In the vi editor, which of the following commands will copy the current line into the vi buffer?
c
cc
1c
yy
1y
The command that will copy the current line into the vi buffer is yy. The yy command is a shorthand for yank yank, which means to yank (copy) the current line. The vi buffer is a temporary storage area where thecopied text is stored until it is pasted somewhere else. The yy command can also be preceded by a number to indicate how many lines to copy. For example, the command 3yy will copy the current line and the next two lines into the buffer.
The other commands are incorrect for the following reasons:
References:
What is the purpose of the Bash built-in export command?
It allows disks to be mounted remotely.
It runs a command as a process in a subshell.
It makes the command history available to subshells.
It sets up environment variables for applications.
It shares NFS partitions for use by other systems on the network.
The export command is a Bash built-in command that exports environment variables and functions for use in other shell sessions1. Environment variables are named values that affect the behavior of applications and processes2. For example, the PATH variable stores a list of directories where executable programs are located, and the LANG variable sets the language and locale of the system2. By using the export command, you can make these variables available to any child process spawned by the current shell1. For example, if you want to set the EDITOR variable to vim for all subshells, you can run:
export EDITOR=vim
The export command can also be used to export functions, which are blocks of code that can be reused by invoking their name3. For example, if you want to create and export a function that prints “Hello world”, you can run:
hello () { echo “Hello world”; } export -f hello
Then, you can call the hello function in any subshell or script that inherits the environment from the current shell.
The other options are not related to the export command. Option A refers to the mount command, which attaches a filesystem to a directory4. Option B refers to the command substitution feature, which runs a command in a subshell and replaces it with its output5. Option C refers to the history command, which displays the command history of the current shell. Option E refers to the exportfs command, which maintains the table of exported NFS shares.
References:
Which of the following commands kills the process with the PID 123 but allows the process to "clean up" before exiting?
kill -PIPE 123
kill -KILL 123
kill -STOP 123
kill -TERM 123
The command kill -TERM 123 kills the process with the PID 123 but allows the process to “clean up” before exiting. The option -TERM specifies the signal to be sent to the process, which is the termination signal (SIGTERM). This signal requests the process to terminate gracefully, which means that the process can perform any necessary actions before exiting, such as closing files, releasing resources, or saving data. The process can also catch the signal and ignore it or handle it in a different way, if it is programmed to do so. The syntax is: kill -TERM pid. For example, kill -TERM 123 will send the SIGTERM signal to the process with the PID 123, asking it to terminate nicely. The other options are not correct because:
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:
Regarding the command:
nice -5 /usr/bin/prog
Which of the following statements is correct?
/usr/bin/prog is executed with a nice level of -5.
/usr/bin/prog is executed with a nice level of 5.
/usr/bin/prog is executed with a priority of -5.
/usr/bin/prog is executed with a priority of 5.
The nice command is used to start a process with a modified scheduling priority. The scheduling priority is a value that determines how much CPU time a process will receive from the kernel. The lower the priority, the more CPU time a process will get. The priority is also known as the nice value, because a process with a high nice value is being nice to other processes by giving up CPU time. The nice value ranges from -20 to 19, with -20 being the highest priority and 19 being the lowest. By default, processes are started with a nice value of 0, which means normal priority.
The nice command takes an optional argument -n followed by a number, which specifies the increment or decrement of the nice value from the default value of 0. For example, the command:
nice -n 5 /usr/bin/prog
will start the /usr/bin/prog process with a nice value of 5, which means a lower priority than the default. Similarly, the command:
nice -n -5 /usr/bin/prog
will start the /usr/bin/prog process with a nice value of -5, which means a higher priority than the default. If the -n argument is omitted, the nice command will assume a default increment of 10. For example, the command:
nice /usr/bin/prog
will start the /usr/bin/prog process with a nice value of 10, which means a very low priority. Note that only the root user can start a process with a negative nice value, as this requires special privileges.
Therefore, the command:
nice -5 /usr/bin/prog
is equivalent to:
nice -n -5 /usr/bin/prog
and will start the /usr/bin/prog process with a nice value of -5, which means a higher priority than the default. This means that the correct answer is B. /usr/bin/prog is executed with a nice level of 5.
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 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 shell redirections will write standard output and standard error output to a file named filename?
2>&1 >filename
>filename 2>&1
1>&2>filename
>>filename
1&2>filename
The shell redirection that will write standard output and standard error output to a file named filename is >filename 2>&1. This command uses the following syntax:
The order of the redirections is important, as they are processed from left to right. If the order was reversed, as in 2>&1 >filename, the command would not work as expected, because it would first redirect standard error to the current standard output (which is the terminal by default), and then redirect standard output to the file, leaving standard error unchanged.
The other commands are incorrect for the following reasons:
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 of the following commands is used to change options and positional parameters for a running Bash?
history
set
bashconf
setsh
envsetup
The command that is used to change options and positional parameters for a running Bash is set. The set command allows the user to modify the behavior of the shell by enabling or disabling various options, such as -x (trace mode), -e (exit on error), -u (treat unset variables as errors), and others. The set command can also be used to assign values to the positional parameters, which are the arguments passed to the shell or a shell script. The positional parameters are denoted by $1, $2, $3, and so on, up to $9. The special parameter 0referstothenameoftheshellortheshellscript.Thespecialparameter# refers to the number of positional parameters. The special parameter $@ refers to all the positional parameters as a list.
To change the positional parameters, the set command can be used with the – option, followed by the new arguments. For example, the following command will set the positional parameters to “a”, “b”, and “c”:
set – a b c
After this command, $1 will be “a”, $2 will be “b”, 3willbe"c",# will be 3, and $@ will be “a b c”. The – option signals the end of options and prevents any argument that starts with a - from being interpreted as an option. Alternatively, the set command can be used with the - option, followed by the new arguments. However, this will also disable the -x and -v options, if they were previously enabled. For example, the following command will set the positional parameters to “-a”, “-b”, and “-c”, and turn off the trace and verbose modes:
set - -a -b -c
The set command can also be used without any option or argument, in which case it will display the names and values of all shell variables and functions.
The other commands are not valid or relevant for changing options and positional parameters for a running Bash. The history command displays the history list of commands entered by the user. The bashconf command does not exist. The setsh command does not exist. The envsetup command does not exist.
References:
Which SysV init configuration file should be modified to disable the ctrl-alt-delete key combination?
/etc/keys
/proc/keys
/etc/inittab
/proc/inittab
/etc/reboot
The /etc/inittab file is used by the SysV init system to configure the behavior of different runlevels and the actions to be taken when certain events occur. One of the events that can be configured is the ctrl-alt-delete key combination, which by default triggers a system reboot. To disable this feature, the /etc/inittab file should be modified to comment out or remove the line that starts with ca::ctrlaltdel:. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.1
The 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 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 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 run levels should never be declared as the default run level when using SysV init? (Choose TWO correct answers.)
0
1
3
5
6
Run levels are predefined modes of operation in the SysV init system that determine which processes and services are started or stopped. The default run level is the one that the system enters after booting. It is usually specified in the /etc/inittab file with a line like id:5:initdefault:. The run levels 0 and 6 should never be declared as the default run level because they are used to halt and reboot the system, respectively. If they are set as the default, the system will enter an endless loop of shutting down and restarting. The other run levels (1-5) have different meanings depending on the distribution, but they usually correspond to single-user mode, multi-user mode, network mode, graphical mode, etc. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.3
Which 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 of the following statements are true regarding /dev/ when using udev? (Choose TWO correct answers.)
Entries for all possible devices get created on boot even if those devices are not connected.
Additional rules for udev can be created by adding them to /etc/udev/rules.d/.
When using udev, it is not possible to create block orcharacter devices in /dev/ using mknod.
The /dev/ directory is a filesystem of type tmpfs and is mounted by udev during system startup.
The content of /dev/ is stored in /etc/udev/dev and is restored during system startup.
udev is a device manager that dynamically creates and removes device nodes in the /dev/ directory. It also handles device events, such as adding, removing, or changing the attributes of devices. udev uses rules to match devices and assign properties, permissions, names, symlinks, and other actions. The rules are stored in files under /lib/udev/rules.d/ and /etc/udev/rules.d/. The latter directory can be used to create additional or override existing rules. The /dev/ directory is not a regular directory on the root filesystem, but a virtual filesystem of type tmpfs that is mounted by udev during system startup. tmpfs is a filesystem that resides in memory and can grow and shrink dynamically. The content of /dev/ is not stored in /etc/udev/dev, but is created by udev based on the rules and the available devices. udev does not prevent the creation of block or character devices in /dev/ using mknod, but it may overwrite or remove them if they conflict with the rules or the device events. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 102.4
Which 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 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
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
Which of the following options for the kernel's command line changes the systemd boot target to rescue.target instead of the default target?
systemd.target=rescue.target
systemd.runlevel=rescue.target
systemd.service=rescue.target
systemd.default=rescue.target
systemd.unit=rescue.target
Which of the following commands reboots the system when using SysV init? (Choose TWO correct answers.)
shutdown -r now
shutdown -r "rebooting"
telinit 6
telinit 0
shutdown -k now "rebooting"
The shutdown command is used to bring the system down in a safe and controlled way. It can take various options and arguments, such as the time of shutdown, the message to broadcast to users, the halt or reboot mode, etc. The option -r instructs the shutdown command to reboot the system after shutting down. The argument now means to shut down immediately. Therefore, shutdown -r now will reboot the system without delay. The telinit command is used to change the run level of the system. It takes a single argument that specifies the new run level. The run level 6 is reserved for rebooting the system. Therefore, telinit 6 will also reboot the system. The other options are either incorrect or irrelevant. shutdown -r “rebooting” will also reboot the system, but with a delay of one minute and a message to the users. telinit 0 will halt the system, not reboot it. shutdown -k now “rebooting” will only send a warning message to the users, but not actually shut down or reboot the system. References: LPI Linux Essentials - 1.101.2, LPI Linux Administrator - 101.3
What 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: 2: 3:
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.
How can the list of files that would be installed by the RPM package file apache-xml.rpm be previewed?
rpm –qp apache-xml.rpm
rpm –qv apache-xml.rpm
rpm –ql apache-xml.rpm
rpm –qpl apache-xml.rpm
The command rpm -qpl apache-ql.rpm is used to preview the list of files that would be installed by the RPM package file apache-xml.rpm. This command queries the package file without installing it and lists the contents of the package. Here’s what each part of the command means:
So, when you run this command, it will display a list of all the files that are included in the apache-xml.rpm package file, without installing it. This can be useful for checking what files are included in the package before installing it or comparing it with another version of the package.
The other commands are either invalid or do not perform the same function as the correct answer. For example:
References:
Which of the following commands instructs SysVinit to reload its configuration file?
reinit
initreload
telinit 7
telinit q
init reinit
SysVinit is a program for Linux and Unix-based systems that initializes the system and spawns all other processes. It runs as a daemon and has PID 1. The boot loader starts the kernel and the kernel starts SysVinit. A Linux or Unix based system can be started up into various runlevels, which are modes of operation that define what services and processes are running. The /etc/inittab file is the configuration file for SysVinit, which defines the default runlevel, the available runlevels, and the actions to be taken when entering or leaving a runlevel.
The telinit command is used to change the current runlevel of the system or to send a signal to SysVinit. The telinit command takes a single argument, which can be either a runlevel number (0-6) or a special character. The syntax of the telinit command is:
telinit [runlevel|character]
The runlevel argument instructs SysVinit to switch to the specified runlevel. For example, to switch to runlevel 3, which is the multi-user mode with networking, use the following command:
telinit 3
The character argument instructs SysVinit to perform a special action. For example, to reboot the system, use the following command:
telinit 6
The q character argument instructs SysVinit to reload its configuration file, /etc/inittab, without changing the current runlevel. This is useful when the /etc/inittab file has been modified and the changes need to be applied. For example, to reload the /etc/inittab file, use the following command:
telinit q
The other options are not correct because:
telinit: invalid runlevel: 7
init: invalid runlevel: reinit
References:
In the vi editor, what vi command will copy (but not paste) from the current line at the cursor and the following 16 lines (17 lines total)? Specify the correct vi command without spaces.
17yy
The vi editor is a text editor that operates in two modes: command mode and insert mode. In command mode, the user can enter commands to perform various operations on the text, such as copying, pasting, deleting, moving, searching, etc. In insert mode, the user can type text into the file. To switch from command mode to insert mode, the user can press i, a, o, or other keys. To switch from insert mode to command mode, the user can press Esc. The yy command is used to copy (yank) the current line into a buffer. The number before the yy command specifies how many lines to copy, starting from the current line. Therefore, the command 17yy will copy the current line and the following 16 lines (17 lines total) into a buffer. The buffer can then be pasted into another location by using the p or P command. Note that the command 17yy does not paste the copied lines, it only copies them. References:
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 can be used to locate programs and their corresponding man pages and configuration files?
dirname
which
basename
query
whereis
The correct command to locate programs and their corresponding man pages and configuration files is whereis. The whereis command searches for the binary, source, and manual files for a given command name in a list of standard Linux directories. It can also accept a list of directories to search in by using the -B, -M, or -S options. The whereis command is useful for finding the location and documentation of a program. The other commands are not suitable for this task. The dirname command strips the last component from a file name and returns the directory name. The which command shows the full path of a command that is in the $PATH variable. The basename command strips the directory and suffix from a file name and returns the base name. The query command is not a standard Linux command. References:
Instead of supplying an explicit device in /etc/fstab for mounting, what other options may be used to identify the intended partition? (Choose TWO correct answers.)
FIND
ID
LABEL
NAME
UUID
The correct answers are C and E. Instead of supplying an explicit device in /etc/fstab for mounting, you can also use LABEL or UUID to identify the intended partition. LABEL is a human-readable name that can be assigned to a partition using tools such as e2label, tune2fs, or gparted. UUID is a universally unique identifier that is automatically generated for each partition and can be obtained using tools such as blkid or lsblk. Using LABEL or UUID instead of device names can be useful for avoiding problems caused by device name changes, such as when adding or removing disks. For example, instead of writing something like this in /etc/fstab:
/dev/sda1 /mnt/example ext4 defaults 0 0
You can write something like this:
LABEL=example /mnt/example ext4 defaults 0 0
or
UUID=80b496fa-ce2d-4dcf-9afc-bcaa731a67f1 /mnt/example ext4 defaults 0 0
The other options are not valid ways to identify a partition in /etc/fstab. FIND, ID, and NAME are not supported by the mount command or the /etc/fstab file. For more information on how to use LABEL and UUID in /etc/fstab, you can refer to the following articles:
Pressing the Ctrl-C combination on the keyboard while a command is executing in the foreground sends which of the following signal codes?
1(SIGHUP)
2(SIGINT)
3(SIGQUIT)
9(SIGKILL)
15(SIGTERM)
The command line that will create or, in case it already exists, overwrite a file called data with the output of ls is ls > data. The > character is a redirection operator that redirects the standard output (STDOUT) of a command to a file. If the file does not exist, it will be created. If the file already exists, it will be overwritten. The 3> character is not a valid redirection operator. The >& character is a redirection operator that redirects both standard output (STDOUT) and standard error (STDERR) of a command to a file. The >> character is a redirection operator that appends the standard output (STDOUT) of a command to a file, without overwriting the existing file contents. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.3: Perform basic file management, Redirection
Which of the following commands will produce the following output?
jobs
proclist
netstat
ps
The ps command will produce the output shown in the image. The ps command displays information about the processes running on the system. The output format can be customized by using different options. For example, ps -aux will show all processes with detailed information, such as user, PID, CPU, memory, command, and so on. The output in the image matches the format of ps -aux. The jobs command will show the status of jobs in the current shell. The proclist command is not a valid Linux command. The netstat command will show network connections, routing tables, and statistics. References: LPI Exam 101 Detailed Objectives, Topic 103: GNU and Unix Commands, Weight: 25, Objective 103.3: Perform basic file management, ps command, jobs command, netstat command
Which of the following commands will change the quota for a specific user?
edquota
repquota
quota -e
quota
The correct command to change the quota for a specific user is edquota. This command allows you to edit the quota limits for a user, a group, or a file set. You can specify the name of the user that you want to edit the quotas for after the command. For example, to change the disk quota for user ‘linuxconfig’, you can use the following command:
sudo edquota -u linuxconfig
This command will open an editor with the current quota information for the user ‘linuxconfig’. You can modify the soft and hard limits for the block and inode usage as per your requirements. You can also use the -p option to copy the quota settings from another user. For example, to copy the quota settings from user ‘ramesh’ to user ‘linuxconfig’, you can use the following command:
sudo edquota -p ramesh -u linuxconfig
The other commands are not suitable for changing the quota for a specific user. The repquota command displays a summary of the current quota usage and limits for the users or groups. The quota -e command turns off the disk quota for the current user. The quota command shows the disk quota and usage for the current user or for the users specified on the command line. For more information on how to use disk quota on Linux, you can refer to the following articles:
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 SysV init configuration file is commonly used to set the default run level? (Specify the full name of the file, including path.)
/etc/inittab
The /etc/inittab file is a plain text file that contains information about the initialization process of the system. It defines the default run level, the available run levels, and the actions to be taken when entering or leaving a run level. The default run level is the mode of operation that the system starts up into, and it determines which services and processes are running. The default run level 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 run level, which can range from 0 to 6. The meaning of each run level is:
To change the default run level, edit the /etc/inittab file as root and change the number to the desired run level. For example, to change the default run level 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:
Creating a hard link to an ordinary file returns an error. What could be the reason for this?
The source file is hidden.
The source file is read-only.
The source file is a shell script.
The source file is already a hard link.
The source and the target are on different filesystems.
The most likely reason for getting an error when creating a hard link to an ordinary file is that the source and the target are on different filesystems. A hard link is a directory entry that points to the same inode as the original file. An inode is a data structure that stores the metadata and location of a file on a filesystem. A hard link cannot span across different filesystems because each filesystem has its own inode table and numbering scheme. Therefore, a hard link can only refer to a file that exists on the same filesystem as the link. This is mentioned in the article by How-To Geek1 and the man page of ln2. The other options are not valid reasons for getting an error when creating a hard link. The source file being hidden, read-only, or a shell script does not affect the ability to create a hard link, as long as the user has the appropriate permissions. The source file being already a hard link also does not prevent creating another hard link to the same file, as long as the maximum number of links per inode is not exceeded. This is explained in the article by Linuxize3 and the man page of ln
Copyright © 2021-2024 CertsTopics. All Rights Reserved