Removing a Package: Completely Removing Files and Configuration Files | Linux LFCS Exam

Removing a Package: Completely Removing Files and Configuration Files

Question

When removing a package, which of the following dpkg options will completely remove the files including configuration files?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

C

The correct answer is option C: --purge.

Explanation:

dpkg is a package management system used in Debian-based Linux distributions such as Ubuntu, Debian, etc. It is used to install, remove, and manage packages on the system.

When removing a package using dpkg, there are four options available: --clean, --delete, --purge, and --remove. Out of these, the option that will completely remove the package files, including configuration files is --purge.

Here's what each of the options does:

  • --clean: This option removes any downloaded package files that are no longer needed. It does not remove the installed package or its configuration files.
  • --delete: This option removes the installed package files, but it leaves behind the configuration files. The package can be reinstalled later with its previous configuration.
  • --purge: This option removes the installed package files along with their configuration files. It completely removes all traces of the package from the system.
  • --remove: This option is similar to --delete, and it also leaves the configuration files behind.

Therefore, when you want to completely remove a package and all its configuration files, you should use the --purge option. For example, to completely remove the package named "example", you would use the following command:

css
sudo dpkg --purge example

Note that using --purge can result in data loss, so be careful when using this option. It's always a good idea to back up your important data before making any major changes to your system.