UNIX MCQs – Software Management (Part – 2)

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.

Related Articles

Linux MCQ

Welcome to Linux Multiple Choice Questions (MCQ) Section Embark on a journey through the world of...