Linux Package Management 3 — Questions and Answers
Question 1: Which command removes a package along with its configuration files on Debian-based systems?
- apt-get remove
- apt-get purge (Correct answer)
- dpkg -r
- dpkg --remove --config
Correct answer: apt-get purge
`apt-get purge` removes the package and its configuration files, whereas `remove` leaves config files behind.
Question 2: In RPM, what does the `Epoch` field in a package's NEVRA (Name-Epoch-Version-Release-Architecture) override?
- The package name during conflicts
- The version comparison order (Correct answer)
- The release tag only
- The architecture compatibility
Correct answer: The version comparison order
The Epoch field overrides version comparison, so a package with a higher Epoch is always considered newer regardless of version numbers.
Question 3: Which file would you edit to pin an APT package to a specific version on Ubuntu?
- /etc/apt/sources.list
- /etc/apt/preferences (Correct answer)
- /etc/dpkg/hold.conf
- /var/lib/apt/pin
Correct answer: /etc/apt/preferences
`/etc/apt/preferences` (or files in `/etc/apt/preferences.d/`) is used for APT pinning to control which versions are installed.
Question 4: What does `flatpak update` do without specifying a package name?
- Updates only system-wide Flatpaks
- Updates all installed Flatpak applications (Correct answer)
- Refreshes Flatpak remote repositories only
- Checks for updates but doesn't install them
Correct answer: Updates all installed Flatpak applications
Running `flatpak update` without arguments updates all installed Flatpak applications and runtimes.
Question 5: How do you list only manually installed packages (not auto-installed dependencies) with `apt`?
- apt list --installed
- apt-mark showmanual (Correct answer)
- dpkg -l --manual
- apt list --manual
Correct answer: apt-mark showmanual
`apt-mark showmanual` lists packages that were explicitly installed by the user rather than pulled in automatically as dependencies.
Question 6: Which `rpm` option extracts files from an RPM package without installing it?
- rpm -i --test
- rpm2cpio pkg.rpm | cpio -idmv (Correct answer)
- rpm --extract pkg.rpm
- rpm -U --nodeps
Correct answer: rpm2cpio pkg.rpm | cpio -idmv
`rpm2cpio` converts an RPM to a cpio archive, which `cpio -idmv` then extracts to the current directory without touching the RPM database.
Question 7: What is the purpose of `snap refresh --hold` on Ubuntu?
- Pauses automatic snap updates indefinitely
- Temporarily pauses snap updates for a set time (Correct answer)
- Holds a specific snap at its current version
- Prevents new snaps from being installed
Correct answer: Temporarily pauses snap updates for a set time
`snap refresh --hold` pauses automatic updates for a configurable duration (default 90 days), not permanently.
Which command removes a package along with its configuration files on Debian-based systems?