How to Remove Residual Files After Uninstalling Software on Linux

Completely Remove Linux Program Hero

Linux doesn’t have the registry hell of Windows. For most users, that’s a major benefit: one less incredibly-delicate, constantly-modified central database to be concerned over. The downside is that uninstallation of software and utilities requires either a helpful installer utility or careful combing through of your user files. Many programs do have uninstallation routines or utilities, especially those installed through package managers like apt-get, but others require a manual removal of leftover files after uninstalling the software.

As long-time users of Linux know, there’s not much need to “warn” the operating system about removing files. Everything on the hard drive is a file of equal merit. As a result, removing a “program” is really just removing a collection of files that work together. Ideally, an uninstaller would take care of those for you, but not every program is so well-managed.

Also read: How to Bulk Rename Files in Linux with Thunar’s Bulk Rename Tool

Uninstalling Programs with a Package Manager

Whenever possible, remove the application package using the package manager you used to install it. For example, if you installed the application in Ubuntu Software or Gnome Software, you can uninstall the software from the same place.

You can also look at the INSTALL or README files for the packages you have installed. You can find these with the primary binaries of the package.

Using Synaptic

Synaptic is a GUI package manager for Debian-based Linux applications. It has more capable removal tools available than the default package management applications.

Install Synaptic through Ubuntu Software or apt-get:

sudo apt-get install synaptic

Once installed, launch Synaptic to view all installed packages. It marks packages currently installed with a green square. You can also filter for installed applications, only using the sidebar.

To completely remove an application, right-click its installed package and choose “Mark for Complete Removal” from the context menu.

Completely Remove Linux Program Synaptic Mark Remove

This marks the files for deletion. To remove the files, click “Apply” or press Ctrl + P on your keyboard.

Completely Remove Linux Program Synaptic Apply Remove

Using apt-get

If you installed the software with apt-get, remove it with apt-get. This will include the same packages as those found in Synaptic. But considering the slight possibility of variance between apt-get and Synaptic, you may prefer to remove your software with the same package manager that installed it. This will always ensure a complete deletion.

To remove a package and all associated files from your system, execute the following command:

sudo apt-get purge package-name

Replace package-name with the name of the package you wish to remove. In our example, we’re removing wireshark.

Completely Remove Linux Program Apt Get Purge 1

Once the package is found, type “Y” and then press “Enter” to confirm the package’s removal.

Completely Remove Linux Program Apt Get Purge 2

Using the purge command will remove the application as well as its configuration files. It does not remove the application’s dependencies though. To remove any remaining dependencies that were automatically downloaded with the original package, run the following command:

sudo apt-get autoremove

This will remove all unnecessary dependencies, including any orphaned by removing their parent package.

Using yum-remove

Uninstalllinux Yum Remove

If your Linux distro uses yum instead of apt-get, use this command:

sudo yum remove package-name

Again, replace package-name with the name of the package you wish to remove. To uninstall multiple packages, list them after the remove command.

sudo yum remove wireshark tmux unzip

If you installed packages using yum’s Groups functionality, you’ll need to remove them as a group.

sudo yum remove @"Group Name"

Replace with the appropriate group name to remove all repositories associated with that group. The @ sign specifies a group, and the quotes are used to capture the space in the name of the group. If the name has no space, quotes are not strictly necessary.

Manually Removing User Configuration Files

After uninstallation, you may want to manually scan the following directories for the user config and residual files:

  • ~/
  • /usr/bin
  • /usr/lib
  • /usr/local
  • /usr/share/man
  • /usr/share/doc
  • /var
  • /run
  • /lib
  • ~/.cache
  • ~/.local
  • ~/.local/share
  • ~/.thumbnail
  • ~/.config/

Note: ~/ means the Home folder, and “~/.local” is a hidden folder (named .local) in the Home folder. You will need to press Ctrl + H to view the hidden files/folders in your File manager.

User config files are usually stored in their application-specific folder, so you can easily spot them by their folder’s name.

Linux Local Share Folders

You’ll also want to look for package-specific files that share the package name. For example, the KDE uses “~/.kde” to store user configuration files.

Conclusion

The best and easiest way to remove applications on Linux is with the package manager that installed the applications. Since package managers install the vast majority of software on most Linux platforms, simply using your package manager to remove it covers an enormous variety of circumstances. However, in most cases, your user config files will still be untouched in the Home folder, so it is best for you to go through the “~/.local” folder to make sure all residual files are removed.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Alexander Fox

Alexander Fox is a tech and science writer based in Philadelphia, PA with one cat, three Macs and more USB cables than he could ever use.