dpkg: purge versus remove

dpkg can be used to install, remove and check the current state of a package. Every package contains the following components

  1. package binaries
  2. configuration files

dpkg has two options –remove and –purge. Both these options are used to remove package contents. But there is a significant difference between the two.’

dpkg –remove is used to remove the package binaries. But if there are configuration files, those will not be removed

$ dpkg --remove package_name

After removing the package, the state of the package becomes un or rc.

dpkg –purge is used to remove the package binaries and the configuration files.

$ dpkg --purge package_name

After removing the package, the state of the package becomes un or pn.