APT manages system packages separately from personal files. On Ubuntu and Debian, purging an APT-installed program removes its package configuration too, while application-specific user settings and data need a separate review.

The remove operation normally preserves package configuration; purge deletes it, including configuration left by an earlier removal. Neither operation clears home directories. APT has no uninstall subcommand, and it cannot remove a separately installed Snap or a manually copied application.

GNU Wget serves as the example because it has both system configuration and per-user files. Its downloaded documents are separate from its settings and HSTS security database, and autoremove considers unused automatic packages across the system, not just those Wget used.

Steps to remove an APT program and its settings on Ubuntu and Debian:

  1. Confirm the installed package name for the application.
    $ apt list --installed wget
    wget/resolute-updates,resolute-security,now 1.25.0-2ubuntu4.4 arm64 [installed]
    Notice: There is 1 additional version. Please use the '-a' switch to see it

    For another application, substitute its exact package name and documented file paths throughout. Removing only a metapackage may leave the actual application installed.

  2. List the Wget settings and data files for your account.
    $ ls -l /etc/wgetrc ~/.wgetrc ~/.wget-hsts
    -rw-r--r-- 1 root   root   4942 Aug 19 23:59 /etc/wgetrc
    -rw------- 1 reader reader   82 Nov  6 15:43 /home/reader/.wget-hsts
    -rw------- 1 reader reader   13 Nov  6 15:43 /home/reader/.wgetrc

    /etc/wgetrc is package configuration, ~/.wgetrc holds personal settings, and ~/.wget-hsts stores remembered HTTPS-only policies. Either personal file may be absent. For another application, its documentation lists any other files it keeps, because a purge does not promise to delete all data.

    Any file you want to keep needs a private copy first, because the next steps delete it.

  3. Purge the package, answering y only if the list shows what you intend to remove.

    Purging deletes the package's system configuration and removes the application for all users. Some applications also delete service data. Stop any running copy first, and enter n if the list includes a desktop, service, or other application you still need. Scheduled jobs or scripts that call Wget will fail after this.

    $ sudo apt purge wget
    ##### snipped #####
    REMOVING:
      wget*
    
    Summary:
      Upgrading: 0, Installing: 0, Removing: 1, Not Upgrading: 4
      Freed space: 762 kB
    
    Continue? [Y/n] y
    ##### snipped #####
    Removing wget (1.25.0-2ubuntu4.4) ...
    ##### snipped #####
    Purging configuration files for wget (1.25.0-2ubuntu4.4) ...
  4. Remove the unused dependencies, answering y only if everything listed is expendable.

    The list depends on your system and may include packages unrelated to Wget, and --purge also deletes their package configuration. Enter n to skip this cleanup if you still need any listed package.

    $ sudo apt autoremove --purge
    ##### snipped #####
    REMOVING:
      libffi8*         libhogweed6t64*  libp11-kit0*  libtasn1-6*
      libgnutls30t64*  libnettle8t64*   libpsl5t64*
    
    Summary:
      Upgrading: 0, Installing: 0, Removing: 7, Not Upgrading: 4
      Freed space: 6093 kB
    
    Continue? [Y/n] y
    ##### snipped #####
    Removing libgnutls30t64:arm64 (3.8.12-2ubuntu1.1) ...
    ##### snipped #####
  5. Delete your personal Wget files.

    This removes your Wget preferences and remembered HSTS policies for the current account, with no prompt. Any file you are keeping, or that the earlier listing did not show, does not belong in the command. Downloaded documents and other users' files stay.

    $ rm ~/.wgetrc ~/.wget-hsts
  6. Verify that the system configuration and personal files are gone.
    $ ls -l /etc/wgetrc ~/.wgetrc ~/.wget-hsts
    ls: cannot access '/etc/wgetrc': No such file or directory
    ls: cannot access '/home/reader/.wgetrc': No such file or directory
    ls: cannot access '/home/reader/.wget-hsts': No such file or directory
Share this guide