What is the difference between the --remove and the --purge action with the dpkg command?
Correct Answer: A
The dpkg command is a tool to install, build, remove and manage Debian packages. The option --remove is used to remove an installed package, but it does not remove the configuration files that may have been modified by the user. The option --purge is used to remove an installed package and also delete its configuration files. This can be useful if the user wants to completely uninstall a package and start from scratch if it is reinstalled later. The syntax is: dpkg --remove package or dpkg --purge package. For example, dpkg --remove nginx will remove the nginx web server package, but it will leave the configuration files in /etc/nginxdpkg --purge nginx will remove the nginx package and also delete the configuration files in /etc/nginx1. The other options are not correct because: * -remove only removes the program, --purge only removes the config files: This is false, because -- purge also removes the program, not just the config files. * -remove removes a package, --purge also removes all packages dependent on it: This is false, because -- purge does not remove any other packages, only the specified one. To remove a package and its dependencies, the apt-get command can be used with the option --auto-remove2. * -remove removes only the package file itself, --purge removes all files related to the package: This is false, because --remove also removes the files that are installed by the package, not just the package file itself. --purge only removes the configuration files that are not removed by --remove. References: * dpkg(1) - dpkg - Debian buster - Debian Manpages * How to remove a package and its dependencies with dpkg? - Ask Ubuntu
101-500 Exam Question 87
In order to display all currently mounted filesystems, which of the following commands could be used? (Choose TWO correct answers.)
Correct Answer: A,C
The correct commands to display all currently mounted filesystems are cat /proc/self/mounts and mount. The cat /proc/self/mounts command reads the contents of the /proc/self/mounts file, which is a symbolic link to /proc/mounts. This file contains information about all the filesystems that are currently mounted on the system, as reported by the kernel. The mount command without any arguments shows all the mounted filesystems, as recorded by the mount and umount commands. The other options are incorrect because they do not display the mounted filesystems. The free command shows the amount of free and used memory in the system. The lsmounts command is not a standard Linux command. The cat /proc/filesystems command shows the filesystem types that are supported by the kernel. References: * [LPI Linux Essentials - 2.2 Mounting, Unmounting Filesystems] * How to get the complete and exact list of mounted filesystems in Linux? - Unix & Linux Stack Exchange * 4 Commands to List Mounted File Systems in Linux - Linux Shell Tips * How To Show Mounted Devices In Linux Operating System * How to Check if a Filesystem is Mounted in Linux?
101-500 Exam Question 88
Which of the following commands lists the dependencies of the RPM package file foo.rpm?
Correct Answer: A
The command that lists the dependencies of the RPM package file foo.rpm is rpm -qpR foo.rpm. The rpm command is the low-level tool for managing RPM packages on Linux systems. The -q or --query option is used to query information about installed or uninstalled packages. The -p or --package option is used to specify a package file instead of an installed package name. The -R or --requires option is used to list the capabilities that the package requires. The capabilities are usually the names of other packages, libraries, or files that the package depends on. The rpm command is part of the 101.1 Determine and configure hardware settings topic of the LPI Linux Essentials certification program . The other options are either invalid or do not perform the desired task. The rpm -dep foo command does not exist, as -dep is not a valid option for rpm. The rpm -ld foo.rpm command does not list the dependencies of the package file, but the files in the package. The rpm -R foo.rpm command does not list the dependencies of the package file, but the capabilities that the package provides. The rpm -pD foo command does not exist, as - pD is not a valid option for rpm. References: * Linux Essentials - Linux Professional Institute Certification Programs * Exam 101 Objectives - Linux Professional Institute * rpm(8) - Linux manual page * RPM Package Manager - Wikipedia
101-500 Exam Question 89
After running the command umount /mnt, the following error message is displayed: umount: /mnt: device is busy. What is a common reason for this message?
Correct Answer: B
One of the common reasons for the error message "device is busy" when trying to unmount a file system is that a user or a process has a file open in the mounted directory. This prevents the kernel from releasing the file system resources and detaching the device. To find out which user or process is holding the file system, one can use the lsof or fuser commands12. For example, lsof /mnt or fuser -m /mnt will list the processes that have open files in /mnt. To force the unmounting of a busy file system, one can use the -l option of the umount command, which will perform a lazy unmount. This means that the file system will be detached as soon as it is not busy anymore3. References: 1: How to solve "device is busy" problem in Linux 2: How to Find Out Which Process Is Using a File in Linux 3: umount(8) - Linux man page
101-500 Exam Question 90
What does the command mount -a do?
Correct Answer: D
The command mount -a mounts all filesystems that are listed in the file /etc/fstab and have the option auto set. The option auto means that the filesystem can be mounted automatically by the mount -a command or at boot time. The option noauto means that the filesystem can only be mounted explicitly by the mount command with the device or mount point specified12. The file /etc/fstab contains information about the filesystems that are known to the system and how they can be mounted3. The command mount -a is useful for mounting all the filesystems that are needed by the system after a change in /etc/fstab or after a reboot4. References: 1: mount(8) - Linux man page 2: Linux mount and umount commands help and examples 3: fstab(5) - Linux man page 4: How to Use the mount Command on Linux