UNIX Question and Answer – Software Management
UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test
1. Which command is used to list enabled services in systemd?
a) systemctl list-enabled
b) systemctl show-enabled
c) systemctl list-services –enabled
d) systemctl list-units –type=service –state=enabled
Answer: a) systemctl list-enabled
Explanation: The “systemctl list-enabled” command is used to list enabled services in systemd.
2. What is the purpose of the “systemctl reload” command in systemd?
a) Reloads systemd configuration
b) Reloads a specific service configuration
c) Reloads systemd target units
d) Reloads systemd journal
Answer: b) Reloads a specific service configuration
Explanation: The “systemctl reload” command reloads a specific service configuration in systemd.
3. Which directory contains systemd user unit files?
a) /etc/systemd/user
b) /usr/lib/systemd/user
c) /usr/share/systemd/user
d) /etc/systemd/system
Answer: a) /etc/systemd/user
Explanation: Systemd user unit files are located in the “/etc/systemd/user” directory.
4. What does the command “systemctl list-dependencies” do in systemd?
a) Lists dependencies of a unit
b) Lists dependent units
c) Lists all active dependencies
d) Lists all active dependencies and dependent units
Answer: a) Lists dependencies of a unit
Explanation: The “systemctl list-dependencies” command lists dependencies of a unit in systemd.
5. Which command is used to enable a target in systemd?
a) systemctl enable-target
b) systemctl start
c) systemctl enable
d) systemctl isolate
Answer: c) systemctl enable
Explanation: The “systemctl enable” command is used to enable a target in systemd.
6. What is the purpose of the “systemctl snapshot” command in systemd?
a) Takes a snapshot of the system state
b) Creates a backup of systemd configuration files
c) Saves current unit states
d) Creates a restore point for services
Answer: a) Takes a snapshot of the system state
Explanation: The “systemctl snapshot” command takes a snapshot of the system state in systemd.
7. Which command is used to mask a service in systemd?
a) systemctl mask
b) systemctl disable
c) systemctl stop
d) systemctl enable
Answer: a) systemctl mask
Explanation: The “systemctl mask” command is used to mask a service in systemd.
8. What is the purpose of the “systemctl revert” command in systemd?
a) Reverts changes made to a unit
b) Reverts system to a previous state
c) Reverts system settings
d) Reverts changes made to systemd configuration
Answer: a) Reverts changes made to a unit
Explanation: The “systemctl revert” command reverts changes made to a unit in systemd.
9. Which command is used to reload a unit configuration in systemd without restarting?
a) systemctl reload
b) systemctl reload-service
c) systemctl daemon-reload
d) systemctl restart
Answer: c) systemctl daemon-reload
Explanation: The “systemctl daemon-reload” command reloads a unit configuration in systemd without restarting.
10. What does the command “systemctl set-default” do in systemd?
a) Sets the default target
b) Sets the default service
c) Sets the default state
d) Sets the default mode
Answer: a) Sets the default target
Explanation: The “systemctl set-default” command sets the default target in systemd.
11. Which command is used to disable a target in systemd?
a) systemctl disable-target
b) systemctl disable
c) systemctl stop
d) systemctl mask
Answer: b) systemctl disable
Explanation: The “systemctl disable” command is used to disable a target in systemd.
12. What is the purpose of the “systemctl unmask” command in systemd?
a) Unmasks a service
b) Masks a service
c) Enables a service
d) Disables a service
Answer: a) Unmasks a service
Explanation: The “systemctl unmask” command unmasks a service in systemd.
13. Which command is used to reload all unit files and recreate the dependency tree in systemd?
a) systemctl reload
b) systemctl daemon-reload
c) systemctl reset
d) systemctl restart
Answer: b) systemctl daemon-reload
Explanation: The “systemctl daemon-reload” command reloads all unit files and recreates the dependency tree in systemd.
14. What does the command “systemctl rescue” do in systemd?
a) Switches to rescue mode
b) Starts a specific service
c) Stops a specific service
d) Switches to multi-user target
Answer: a) Switches to rescue mode
Explanation: The “systemctl rescue” command switches to rescue mode in systemd.
15. Which command is used to start a service in systemd?
a) systemctl start
b) systemctl enable
c) systemctl restart
d) systemctl launch
Answer: a) systemctl start
Explanation: The “systemctl start” command is used to start a service in systemd.
16. What is the purpose of the “systemctl edit” command in systemd?
a) Edits a unit file
b) Edits a service configuration
c) Edits system settings
d) Edits system state
Answer: a) Edits a unit file
Explanation: The “systemctl edit” command is used to edit a unit file in systemd.
17. Which command is used to reload the systemd journal configuration?
a) systemctl reload-journal
b) systemctl restart-journald
c) journalctl –flush
d) journalctl –reload
Answer: c) journalctl –flush
Explanation: The “journalctl –flush” command is used to reload the systemd journal configuration.
18. What is the purpose of the “systemctl enable –now” command in systemd?
a) Enables and starts a service
b) Enables a service but does not start it
c) Starts a service but does not enable it
d) Reloads systemd configuration
Answer: a) Enables and starts a service
Explanation: The “systemctl enable –now” command enables and starts a service in systemd.
19. Which command is used to display the dependency tree of a unit and its status in systemd?
a) systemctl status
b) systemctl list-dependencies
c) systemctl list-units
d) systemctl show
Answer: b) systemctl list-dependencies
Explanation: The “systemctl list-dependencies” command displays the dependency tree of a unit and its status in systemd.
20. What does the command “systemctl switch-root” do in systemd?
a) Switches to a different target
b) Switches to a different root directory
c) Switches to a different operating system
d) Switches to a different user session
Answer: b) Switches to a different root directory
Explanation: The “systemctl switch-root” command switches to a different root directory in systemd.
21. Which command is used to enable persistent logging in systemd?
a) systemctl enable-logging
b) systemctl enable systemd-journald.service
c) systemctl enable-persistence
d) systemctl enable-journal
Answer: b) systemctl enable systemd-journald.service
Explanation: The “systemctl enable systemd-journald.service” command is used to enable persistent logging in systemd.
22. What is the purpose of the “systemctl show” command in systemd?
a) Displays the status of a unit
b) Displays unit properties
c) Displays system settings
d) Displays system state
Answer: b) Displays unit properties
Explanation: The “systemctl show” command displays unit properties in systemd.
23. Which command is used to list all active units and their states in systemd?
a) systemctl list-units –all
b) systemctl list-units –state=active
c) systemctl list-units –state=running
d) systemctl list-units –state=loaded
Answer: b) systemctl list-units –state=active
Explanation: The “systemctl list-units –state=active” command is used to list all active units and their states in systemd.
24. What does the command “systemctl suspend” do in systemd?
a) Puts the system in sleep mode
b) Puts the system in hibernation
c) Shuts down the system
d) Reboots the system
Answer: a) Puts the system in sleep mode
Explanation: The “systemctl suspend” command puts the system in sleep mode in systemd.
25. Which command is used to display the system boot-up time and uptime in systemd?
a) systemctl boot-time
b) systemctl show boot-time
c) systemctl status boot-time
d) systemd-analyze
Answer: d) systemd-analyze
Explanation: The “systemd-analyze” command is used to display the system boot-up time and uptime in systemd.
26. Which command is used to view the contents of a specific package in Debian-based distributions?
a) dpkg -l package-name
b) dpkg -L package-name
c) dpkg -s package-name
d) dpkg -i package-name
Answer: b) dpkg -L package-name
Explanation: The “dpkg -L package-name” command is used to view the contents of a specific package in Debian-based distributions.
27. What is the purpose of the “apt-mark hold” command in Debian-based distributions?
a) Installs a package and holds it from future upgrades
b) Holds a package from being installed or upgraded
c) Removes a package and holds it from future installations
d) Holds a package from being removed
Answer: b) Holds a package from being installed or upgraded
Explanation: The “apt-mark hold” command holds a package from being installed or upgraded in Debian-based distributions.
28. Which command is used to list all installed packages along with their versions in Debian-based distributions?
a) dpkg -l
b) dpkg -L
c) dpkg -s
d) dpkg –get-selections
Answer: a) dpkg -l
Explanation: The “dpkg -l” command lists all installed packages along with their versions in Debian-based distributions.
29. What does the command “apt-cache showpkg” do in Debian-based distributions?
a) Shows detailed information about a package
b) Shows information about package dependencies
c) Shows information about installed packages
d) Shows information about available package versions
Answer: a) Shows detailed information about a package
Explanation: The “apt-cache showpkg” command shows detailed information about a package in Debian-based distributions.
30. Which command is used to display the changelog of a package in Debian-based distributions?
a) apt-changelog
b) apt-listchanges
c) apt-showchangelog
d) apt-history
Answer: c) apt-showchangelog
Explanation: The “apt-showchangelog” command is used to display the changelog of a package in Debian-based distributions.
31. What is the purpose of the “apt-get autoclean” command in Debian-based distributions?
a) Cleans up cached package files
b) Removes old package versions
c) Removes unused packages
d) Removes orphaned packages
Answer: a) Cleans up cached package files
Explanation: The “apt-get autoclean” command cleans up cached package files in Debian-based distributions.
32. Which command is used to display the list of packages installed from a specific repository in Debian-based distributions?
a) apt-cache policy
b) apt-cache show
c) apt-cache madison
d) apt-cache depends
Answer: a) apt-cache policy
Explanation: The “apt-cache policy” command displays the list of packages installed from a specific repository in Debian-based distributions.
33. What does the command “dpkg-reconfigure” do in Debian-based distributions?
a) Reconfigures an installed package
b) Reinstalls an installed package
c) Removes an installed package
d) Downgrades an installed package
Answer: a) Reconfigures an installed package
Explanation: The “dpkg-reconfigure” command reconfigures an installed package in Debian-based distributions.
34. Which command is used to list all available package versions in Debian-based distributions?
a) apt-cache show
b) apt-cache policy
c) apt-cache madison
d) apt-cache versions
Answer: c) apt-cache madison
Explanation: The “apt-cache madison” command is used to list all available package versions in Debian-based distributions.
35. What is the purpose of the “apt-get download” command in Debian-based distributions?
a) Downloads a package without installing it
b) Downloads package sources
c) Downloads package dependencies
d) Downloads package documentation
Answer: a) Downloads a package without installing it
Explanation: The “apt-get download” command downloads a package without installing it in Debian-based distributions.
36. Which command is used to remove a package along with its configuration files in Debian-based distributions?
a) apt-get purge
b) apt-get remove
c) apt-get autoremove
d) apt-get clean
Answer: a) apt-get purge
Explanation: The “apt-get purge” command removes a package along with its configuration files in Debian-based distributions.
37. What is the purpose of the “apt-mark unhold” command in Debian-based distributions?
a) Unholds a package
b) Holds a package from being removed
c) Unholds a package from being installed or upgraded
d) Holds a package from being installed or upgraded
Answer: c) Unholds a package from being installed or upgraded
Explanation: The “apt-mark unhold” command unholds a package from being installed or upgraded in Debian-based distributions.
38. Which command is used to download and install a package along with its dependencies in Debian-based distributions?
a) apt-get install
b) apt-get update
c) apt-get upgrade
d) apt-get dist-upgrade
Answer: a) apt-get install
Explanation: The “apt-get install” command is used to download and install a package along with its dependencies in Debian-based distributions.
39. What does the command “apt-file search” do in Debian-based distributions?
a) Searches for a package in the repositories
b) Searches for a file in the repositories
c) Searches for a package on the system
d) Searches for a file on the system
Answer: b) Searches for a file in the repositories
Explanation: The “apt-file search” command searches for a file in the repositories in Debian-based distributions.
40. Which command is used to install a package from a local .deb file in Debian-based distributions?
a) dpkg -i package-file
b) dpkg -l package-file
c) dpkg -r package-file
d) dpkg -s package-file
Answer: a) dpkg -i package-file
Explanation: The “dpkg -i package-file” command is used to install a package from a local .deb file in Debian-based distributions.
41. What is the purpose of the “apt-get source” command in Debian-based distributions?
a) Installs package sources
b) Downloads package sources
c) Removes package sources
d) Lists package sources
Answer: b) Downloads package sources
Explanation: The “apt-get source” command downloads package sources in Debian-based distributions.
42. Which command is used to view information about a package in Fedora?
a) rpm -qa
b) rpm -q package-name
c) dnf info package-name
d) dnf list package-name
Answer: c) dnf info package-name
Explanation: The “dnf info package-name” command is used to view information about a package in Fedora.
43. What does the command “dnf repoquery –requires” do in Fedora?
a) Lists dependencies of a package
b) Lists packages required by another package
c) Lists repositories required by a package
d) Lists packages required by a repository
Answer: a) Lists dependencies of a package
Explanation: The “dnf repoquery –requires” command lists dependencies of a package in Fedora.
44. Which command is used to download a package without installing it in Fedora?
a) dnf download package-name
b) dnf install package-name –download-only
c) dnf fetch package-name
d) dnf install package-name
Answer: a) dnf download package-name
Explanation: The “dnf download package-name” command is used to download a package without installing it in Fedora.
45. What is the purpose of the “dnf module list” command in Fedora?
a) Lists all enabled modules
b) Lists all available modules
c) Lists installed modules
d) Lists active modules
Answer: b) Lists all available modules
Explanation: The “dnf module list” command lists all available modules in Fedora.
46. Which command is used to list all installed packages in Fedora?
a) dnf list installed
b) dnf list
c) dnf list installed | grep “Installed”
d) dnf repoquery –installed
Answer: a) dnf list installed
Explanation: The “dnf list installed” command lists all installed packages in Fedora.
47. What does the command “dnf group list” do in Fedora?
a) Lists available package groups
b) Lists installed package groups
c) Lists enabled package groups
d) Lists available package categories
Answer: a) Lists available package groups
Explanation: The “dnf group list” command lists available package groups in Fedora.
48. Which command is used to install a package from the official Fedora repository?
a) yum install package-name
b) dnf install package-name
c) yum install package-name –repository=official
d) dnf install package-name –repository=official
Answer: b) dnf install package-name
Explanation: The “dnf install package-name” command is used to install a package from the official Fedora repository.
49. What is the purpose of the “dnf autoremove” command in Fedora?
a) Removes unused packages
b) Removes orphaned packages
c) Removes conflicting packages
d) Removes outdated packages
Answer: a) Removes unused packages
Explanation: The “dnf autoremove” command removes unused packages in Fedora.
50. Which command is used to check if a package is installed in Fedora?
a) dnf check package-name
b) dnf info package-name
c) dnf search package-name
d) dnf list installed | grep package-name
Answer: d) dnf list installed | grep package-name
Explanation: The “dnf list installed | grep package-name” command checks if a package is installed in Fedora.