Linux Package Management 2 — Questions and Answers
Question 1: Which command shows the installation history of packages on an RPM-based system?
- rpm -qa --last
- yum history (Correct answer)
- dnf log
- rpm --changelog
Correct answer: yum history
`yum history` displays a list of all past yum transactions including installs, updates, and removals.
Question 2: On a Debian system, which file lists the configured APT repositories?
- /etc/apt/sources.list (Correct answer)
- /etc/apt/packages.list
- /var/lib/apt/repos
- /etc/sources.conf
Correct answer: /etc/apt/sources.list
`/etc/apt/sources.list` (and files in `/etc/apt/sources.list.d/`) define where APT looks for packages.
Question 3: What does `rpm -V package-name` do?
- Verifies the package's GPG signature
- Checks installed files against the RPM database (Correct answer)
- Validates dependencies are met
- Views the package version
Correct answer: Checks installed files against the RPM database
`rpm -V` (verify) compares the installed files of a package against metadata stored in the RPM database to detect changes.
Question 4: Which `dnf` command would you use to find which package provides the `/usr/bin/python3` binary?
- dnf search python3
- dnf provides /usr/bin/python3 (Correct answer)
- dnf info python3
- dnf whatprovides python3-bin
Correct answer: dnf provides /usr/bin/python3
`dnf provides <path>` queries which package owns or provides a given file or capability.
Question 5: What is a key purpose of the `dpkg --get-selections` command?
- List packages marked for removal
- Export the list of installed packages (Correct answer)
- Show pending package upgrades
- Select packages for installation interactively
Correct answer: Export the list of installed packages
`dpkg --get-selections` outputs all package selections (installed, deinstalled, etc.), commonly used to backup and restore package lists.
Question 6: Which option makes `apt-get` automatically remove packages that were installed as dependencies but are no longer needed?
- apt-get clean
- apt-get autoremove (Correct answer)
- apt-get purge --orphans
- apt-get remove --auto
Correct answer: apt-get autoremove
`apt-get autoremove` removes orphaned dependency packages that are no longer required by any installed package.
Question 7: What does the `zypper` package manager's `dup` subcommand do?
- Duplicates a package to another location
- Performs a distribution upgrade (Correct answer)
- Shows duplicate packages installed
- Downloads updates without installing
Correct answer: Performs a distribution upgrade
`zypper dup` (distribution upgrade) upgrades all packages to match the currently enabled repositories, used in openSUSE Tumbleweed rolling releases.
Which command shows the installation history of packages on an RPM-based system?