Remove all data and settings of an uninstalled application [duplicate]

You can use apt-get purge for the same exact purpose, here is an example:

  1. First remove your desired program using apt remove, then run:

    dpkg -l package-name
    

    You should get:

    ||/ Name              Version       Architecture  Description
    +++-=================-=============-=============-====================
    rc  package-name      1.1            amd64        something
    

    RC means:

    • r package has been removed.
    • c configuration files still lives on your system
  2. Now use apt-get purge for exact same program, this time dpkg -l package-name output should be like:

    ||/ Name              Version       Architecture  Description
    +++-=================-=============-=============-====================
    un  package-name      <none>        <none>        (no description available)
    

The location of the configuration files of an application varies from application to application, and sometimes it is time-consuming to find them. Even if an application has been removed, you can run sudo apt purge <package_name> to purge its configuration files.


This is really simple and straight forward. I do it all the time. Just make sure to change the program name to the one you want to remove.

sudo apt-get --purge remove firefox

Then you want to remove all dependencies that were installed with your program; you no longer need them.

When removing has finished, continue:

sudo apt-get autoremove

Now everything to do with that program, is completely removed and uninstalled. No traces. If you installed a repository/ies, you can remove it/them by going to:

System Settings >> Software & Updates >> Other Software

On this page, you can click one-by-one, all the repositories you aren't using and click the "Remove" button beneath the box.

I hope this helps. This is what I do and it works as it should.

EDIT: if you want to do the first two steps in one line:

sudo apt-get --purge remove firefox && sudo apt-get autoremove

The commands to remove/purge the packages have already been provided in other answers.

There are some discrepancies that can call some confusion, and leave some of the application's folders. If there are foreign files or directories in the applications configuration folders, it may not delete the folder, just the configuration files that it uses.

So the actual configuration files/settings will be removed.

The process should be followed the autoremove command.

This example will perform the task:

In the steps, I install a sample package that will include lots of configuration files. Then the commands that follow will remove the application and all its configuration files including the /etc/apache2 directory.

If you install libapache2-mod-php after installing apache2, the folders with the Php files will remain with the PHP configuration. If you don't install something that uses the shared folder, the folder will also be removed.

$ sudo apt install apache2
$ sudo apt purge apache2
$ sudo apt --purge autoremove

Note:
You can pick a different package to test the understanding of what happens with the install folders. The behavior will be the same for the actual application that you want to remove along with its configuration files and settings.