UNIX Question and Answer โ Software Management
UNIX MCQ โ Multiple Choice Questions for exam, interview, and Entrance Test
1. Which command is used to reinstall all installed packages in Debian-based distributions?
a) apt reinstall
b) apt-get reinstall
c) apt-get install โreinstall $(dpkg โget-selections | awk โ{print $1}โ)
d) apt-get update โreinstall
Answer: c) apt-get install โreinstall $(dpkg โget-selections | awk โ{print $1}โ)
Explanation: This command reinstalls all installed packages in Debian-based distributions.
2. What is the purpose of the โyum history undoโ command in CentOS?
a) Reverts the most recent transaction
b) Reverts all transactions
c) Reverts a specific transaction
d) Reverts package installations
Answer: a) Reverts the most recent transaction
Explanation: The โyum history undoโ command reverts the most recent transaction in CentOS.
3. Which command is used to downgrade a package to a specific version in Arch Linux?
a) pacman -U package-version
b) pacman -S package-version
c) pacman -U $(pacman -Q | awk โ{print $1}โ)
d) pacman -S โforce package-name
Answer: a) pacman -U package-version
Explanation: The โpacman -U package-versionโ command downgrades a package to a specific version in Arch Linux.
4. What is the purpose of the โdnf swapโ command in Fedora?
a) Swaps package versions
b) Swaps package repositories
c) Swaps package groups
d) Swaps package formats
Answer: a) Swaps package versions
Explanation: The โdnf swapโ command swaps package versions in Fedora.
5. Which command is used to clean the package cache in Debian-based distributions?
a) apt clean
b) apt-get clean
c) apt purge
d) apt-get purge
Answer: b) apt-get clean
Explanation: The โapt-get cleanโ command is used to clean the package cache in Debian-based distributions.
6. What is the purpose of the โdnf autoremoveโ command in Fedora?
a) Removes unused packages
b) Removes outdated packages
c) Removes broken packages
d) Removes conflicting packages
Answer: a) Removes unused packages
Explanation: The โdnf autoremoveโ command removes unused packages in Fedora.
7. Which command is used to display the files installed by a package in Fedora?
a) rpm -ql package-name
b) rpm -qf file-path
c) dnf list installed
d) dnf repoquery โlist package-name
Answer: d) dnf repoquery โlist package-name
Explanation: The โdnf repoquery โlist package-nameโ command displays the files installed by a package in Fedora.
8. What does the command โrpm -Uvh package.rpmโ do in CentOS?
a) Installs a package
b) Upgrades a package
c) Uninstalls a package
d) Verifies a package
Answer: b) Upgrades a package
Explanation: The โrpm -Uvh package.rpmโ command upgrades a package in CentOS.
9. Which command is used to display the dependencies of a package in Fedora?
a) dnf repoquery โrequires package-name
b) dnf repoquery โdepends package-name
c) dnf repoquery โprovides package-name
d) dnf repoquery โobsoletes package-name
Answer: a) dnf repoquery โrequires package-name
Explanation: The โdnf repoquery โrequires package-nameโ command displays the dependencies of a package in Fedora.
10. What is the purpose of the โdnf swap-allโ command in Fedora?
a) Swaps all installed packages
b) Swaps all repositories
c) Swaps all package versions
d) Swaps all package groups
Answer: c) Swaps all package versions
Explanation: The โdnf swap-allโ command swaps all package versions in Fedora.
11. Which command is used to list all available package groups in Arch Linux?
a) pacman -Sg
b) pacman -Qg
c) pacman -Qgq
d) pacman -Qqg
Answer: a) pacman -Sg
Explanation: The โpacman -Sgโ command lists all available package groups in Arch Linux.
12. What does the command โpacman -Scโ do in Arch Linux?
a) Removes cached packages
b) Removes old package versions
c) Cleans package cache
d) Checks for package updates
Answer: c) Cleans package cache
Explanation: The โpacman -Scโ command cleans the package cache in Arch Linux.
13. Which command is used to search for a package in Arch Linux?
a) pacman -Ss
b) pacman -Si
c) pacman -Qs
d) pacman -Q
Answer: a) pacman -Ss
Explanation: The โpacman -Ssโ command is used to search for a package in Arch Linux.
14. What is the purpose of the โpacman -Qdtโ command in Arch Linux?
a) Lists all installed packages
b) Lists orphaned packages
c) Lists dependencies of a package
d) Lists packages not required by any other package
Answer: b) Lists orphaned packages
Explanation: The โpacman -Qdtโ command lists orphaned packages in Arch Linux.
15. Which command is used to list installed packages by size in Arch Linux?
a) pacman -Qi
b) pacman -Sl
c) pacman -Qs
d) pacman -Qii
Answer: a) pacman -Qi
Explanation: The โpacman -Qiโ command lists installed packages by size in Arch Linux.
16. What does the command โyum makecacheโ do in CentOS?
a) Refreshes metadata for enabled repositories
b) Cleans metadata and cache
c) Rebuilds RPM database
d) Installs missing dependencies
Answer: a) Refreshes metadata for enabled repositories
Explanation: The โyum makecacheโ command refreshes metadata for enabled repositories in CentOS.
17. Which command is used to enable a repository in Fedora?
a) dnf enable repository-name
b) dnf config-manager โenable repository-name
c) dnf repo-enable repository-name
d) dnf set-repo repository-name โenable
Answer: b) dnf config-manager โenable repository-name
Explanation: The โdnf config-manager โenable repository-nameโ command enables a repository in Fedora.
18. What is the purpose of the โdnf downgradeโ command in Fedora?
a) Downgrades installed packages to a specific version
b) Removes outdated packages
c) Reverts system to a previous state
d) Updates installed packages
Answer: a) Downgrades installed packages to a specific version
Explanation: The โdnf downgradeโ command downgrades installed packages to a specific version in Fedora.
19. Which command is used to list enabled repositories in CentOS?
a) yum repolist
b) yum list enabled
c) yum repository-list
d) yum show-repos
Answer: a) yum repolist
Explanation: The โyum repolistโ command lists enabled repositories in CentOS.
20. What does the command โdnf repoquery โwhatprovidesโ do in Fedora?
a) Lists packages provided by a repository
b) Lists repositories provided by a package
c) Lists packages that provide a specific file
d) Lists repositories that provide a specific package
Answer: c) Lists packages that provide a specific file
Explanation: The โdnf repoquery โwhatprovidesโ command lists packages that provide a specific file in Fedora.
21. Which command is used to display the currently active repositories in Arch Linux?
a) pacman -Qqg
b) pacman -Sl
c) pacman -Qm
d) pacman -Sy
Answer: b) pacman -Sl
Explanation: The โpacman -Slโ command displays the currently active repositories in Arch Linux.
22. What is the purpose of the โpacman -U package-fileโ command in Arch Linux?
a) Installs a package
b) Upgrades a package
c) Downgrades a package
d) Removes a package
Answer: a) Installs a package
Explanation: The โpacman -U package-fileโ command installs a package in Arch Linux.
23. 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: d) dnf repoquery โinstalled
Explanation: The โdnf repoquery โinstalledโ command lists all installed packages in Fedora.
24. What does the command โdnf remove โorphansโ do in Fedora?
a) Removes outdated packages
b) Removes orphaned packages
c) Removes conflicting packages
d) Removes unused packages
Answer: b) Removes orphaned packages
Explanation: The โdnf remove โorphansโ command removes orphaned packages in Fedora.
25. Which command is used to install a package in Arch Linux from the Arch User Repository (AUR)?
a) pacman -U package-name
b) pacman -S package-name
c) yaourt -S package-name
d) yay -S package-name
Answer: d) yay -S package-name
Explanation: The โyay -S package-nameโ command installs a package from the AUR in Arch Linux.
26. Which command is used to list all installed packages in CentOS?
a) yum list installed
b) yum list
c) yum list installed | grep โInstalledโ
d) yum repoquery โinstalled
Answer: a) yum list installed
Explanation: The โyum list installedโ command lists all installed packages in CentOS.
27. What does the command โdnf module listโ do in Fedora?
a) Lists all available modules
b) Lists installed modules
c) Lists enabled modules
d) Lists disabled modules
Answer: a) Lists all available modules
Explanation: The โdnf module listโ command lists all available modules in Fedora.
28. Which command is used to enable a service in systemd?
a) systemctl enable
b) systemctl start
c) systemctl enable-service
d) systemctl start-service
Answer: a) systemctl enable
Explanation: The โsystemctl enableโ command is used to enable a service in systemd.
29. What is the purpose of the โsystemctl statusโ command in systemd?
a) Starts a service
b) Stops a service
c) Restarts a service
d) Displays the status of a service
Answer: d) Displays the status of a service
Explanation: The โsystemctl statusโ command displays the status of a service in systemd.
30. Which command is used to reload systemd configuration without restarting?
a) systemctl reload
b) systemctl reload-service
c) systemctl restart
d) systemctl daemon-reload
Answer: d) systemctl daemon-reload
Explanation: The โsystemctl daemon-reloadโ command is used to reload systemd configuration without restarting.
31. What does the command โjournalctlโ do in systemd?
a) Lists all active services
b) Displays system logs
c) Displays journal files
d) Modifies journal settings
Answer: b) Displays system logs
Explanation: The โjournalctlโ command displays system logs in systemd.
32. Which command is used to list all available unit files in systemd?
a) systemctl list-units
b) systemctl list-services
c) systemctl list-all
d) systemctl list-unit-files
Answer: d) systemctl list-unit-files
Explanation: The โsystemctl list-unit-filesโ command lists all available unit files in systemd.
33. What is the purpose of the โsystemctl maskโ command in systemd?
a) Stops a service and prevents it from being started manually
b) Disables a service and prevents it from being started automatically
c) Enables a service and allows it to be started automatically
d) Reloads systemd configuration without restarting
Answer: a) Stops a service and prevents it from being started manually
Explanation: The โsystemctl maskโ command stops a service and prevents it from being started manually in systemd.
34. Which directory contains unit files in systemd?
a) /etc/systemd/system
b) /etc/systemd/units
c) /usr/lib/systemd/system
d) /usr/share/systemd/units
Answer: c) /usr/lib/systemd/system
Explanation: Unit files in systemd are located in the โ/usr/lib/systemd/systemโ directory.
35. What does the command โsystemctl isolateโ do in systemd?
a) Switches to a different target
b) Starts a specific service
c) Stops a specific service
d) Reloads systemd configuration
Answer: a) Switches to a different target
Explanation: The โsystemctl isolateโ command switches to a different target in systemd.
36. Which command is used to list active units in systemd?
a) systemctl list-units
b) systemctl list-active
c) systemctl list-services
d) systemctl list-all
Answer: a) systemctl list-units
Explanation: The โsystemctl list-unitsโ command is used to list active units in systemd.
37. What is the purpose of the โsystemctl unmaskโ command in systemd?
a) Enables a masked service
b) Disables a masked service
c) Reloads systemd configuration
d) Starts a masked service
Answer: a) Enables a masked service
Explanation: The โsystemctl unmaskโ command enables a masked service in systemd.
38. Which command is used to list failed units in systemd?
a) systemctl list-failed
b) systemctl list-units โfailed
c) systemctl list-errors
d) systemctl list-status
Answer: b) systemctl list-units โfailed
Explanation: The โsystemctl list-units โfailedโ command is used to list failed units in systemd.
39. What is the purpose of the โsystemctl catโ command in systemd?
a) Displays the contents of a unit file
b) Modifies the contents of a unit file
c) Creates a new unit file
d) Deletes a unit file
Answer: a) Displays the contents of a unit file
Explanation: The โsystemctl catโ command displays the contents of a unit file in systemd.
40. Which command is used to reload the systemd journal?
a) systemctl reload-journal
b) systemctl restart-journald
c) journalctl โflush
d) journalctl โreload
Answer: d) journalctl โreload
Explanation: The โjournalctl โreloadโ command is used to reload the systemd journal.
41. What does the command โsystemctl rebootโ do in systemd?
a) Shuts down the system
b) Restarts the system
c) Puts the system in hibernation
d) Puts the system in sleep mode
Answer: b) Restarts the system
Explanation: The โsystemctl rebootโ command restarts the system in systemd.
42. Which command is used to enable persistent journal logging in systemd?
a) systemctl enable-persistence
b) systemctl enable-journal
c) systemctl enable-logging
d) systemctl enable systemd-journald.service
Answer: d) systemctl enable systemd-journald.service
Explanation: The โsystemctl enable systemd-journald.serviceโ command is used to enable persistent journal logging in systemd.
43. What is the purpose of the โjournalctl โvacuum-sizeโ command in systemd?
a) Cleans up old journal files until the disk space used by the journal is below a specified size
b) Deletes all journal files
c) Increases the size limit of the journal
d) Compresses journal files to save disk space
Answer: a) Cleans up old journal files until the disk space used by the journal is below a specified size
Explanation: The โjournalctl โvacuum-sizeโ command cleans up old journal files until the disk space used by the journal is below a specified size in systemd.
44. Which command is used to display the dependency tree of a unit in systemd?
a) systemctl show
b) systemctl list-dependencies
c) systemctl list-unit-dependencies
d) systemctl list-transitive-dependencies
Answer: b) systemctl list-dependencies
Explanation: The โsystemctl list-dependenciesโ command is used to display the dependency tree of a unit in systemd.
45. What does the command โsystemctl poweroffโ do in systemd?
a) Shuts down the system
b) Restarts the system
c) Puts the system in hibernation
d) Puts the system in sleep mode
Answer: a) Shuts down the system
Explanation: The โsystemctl poweroffโ command shuts down the system in systemd.
46. Which command is used to disable a service in systemd?
a) systemctl disable
b) systemctl stop
c) systemctl disable-service
d) systemctl stop-service
Answer: a) systemctl disable
Explanation: The โsystemctl disableโ command is used to disable a service in systemd.
47. What is the purpose of the โsystemctl isolate rescue.targetโ command in systemd?
a) Switches to rescue mode
b) Switches to emergency mode
c) Switches to multi-user target
d) Switches to graphical target
Answer: a) Switches to rescue mode
Explanation: The โsystemctl isolate rescue.targetโ command switches to rescue mode in systemd.
48. Which command is used to reload the systemd target without restarting?
a) systemctl reload
b) systemctl reload-target
c) systemctl restart
d) systemctl daemon-reload
Answer: d) systemctl daemon-reload
Explanation: The โsystemctl daemon-reloadโ command is used to reload the systemd target without restarting.
49. What does the command โsystemctl list-jobsโ do in systemd?
a) Lists all active jobs
b) Lists failed jobs
c) Lists queued jobs
d) Lists completed jobs
Answer: c) Lists queued jobs
Explanation: The โsystemctl list-jobsโ command lists queued jobs in systemd.
50. Which directory contains unit override files in systemd?
a) /etc/systemd/system
b) /etc/systemd/overrides
c) /etc/systemd/user
d) /etc/systemd/systemd.conf.d
Answer: a) /etc/systemd/system
Explanation: Unit override files in systemd are located in the โ/etc/systemd/systemโ directory.