In this question is described how to remove an application with apt-get using the options remove and purge.

Is there a way to list which files are going to be removed with those before effectively doing it?

I saw there is a -s --simulate option, but that does not show with files will be removed after performing the command.

  • The -s option shows what packages will be removed. Why do you need more detail? – Zeiss Ikon Nov 16 '17 at 14:15
  • I want to know which files are really removed... Is it that strange? – nephewtom Nov 16 '17 at 14:17
  • I can run dpkg -L <package-name> and the will list the files associated with that package. I suspect that those ones are the files that will be removed by apt-get remove and apt-get purge. Though not sure if there more details. – nephewtom Nov 16 '17 at 14:24
  • Generally, if you list the files in a package, and remove that package, all those files will be removed unless another installed package depends on them. – Zeiss Ikon Nov 16 '17 at 15:52

It isn’t possible to fully determine the impact of package removal or purge without performing the removal, because maintainer scripts in the package might remove more files than are listed as belonging to the package.

You can determine at least some of the impact though, by listing the files registered for each package which will be removed. When you run apt -s, you’ll see lines prefixes with Remv or Purg depending on whether the package will be removed or purged. Packages which are purged will remove all the files listed by dpkg -L; packages which are removed will remove those files, except the files listed by dpkg-query -W -f='${binary:Package}\n${Conffiles}\n'. In many cases this will cover everything that would be removed.


In general, it's not possible to list what files maybe removed. Packages contain maintainer scripts, and these files may create or remove files. These scripts could be shell scripts, Perl, Python, ... - so it's not possible to determine what's going to get removed without actually running the script.

Also, an ordinary remove doesn't remove configuration files, which are usually those in /etc, but could include other files depending on which were marked as conffiles, but purge removes these as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.