Ubuntu supports multiple ways to install packages from package managers like apt and graphical frontends like Synaptic to compiling from source. Depending on how you installed the package, the steps to remove it will also vary.
Additionally, uninstalling a package often leaves behind orphaned dependencies and residual config files. If you want to completely remove the package from your system, you’ll have to consider those as well.
Uninstall Packages with Apt
As apt is the standard method for installing packages (normal install, local install, PPAs) on Ubuntu, this is also how you’ll remove packages in most cases. If you use tools like checkinstall
, you can even use apt to uninstall packages built from source.
Remove Packages
First of all, you can run apt list --installed
or use tools like apt-mark
to see which packages you’ve got installed. Note the package name and uninstall said package like so
sudo apt remove packagename
Remove Config Files
If you also want to remove global configurations created by the package, you can use purge instead. Do note that this doesn’t revert config changes or remove config files stored in your home directory. You’ll have to perform those actions manually.
sudo apt purge packagename
Remove Dependencies
When installing most packages, additional packages are also pulled in as dependencies. After removing the main package, these dependencies are usually no longer required by any programs. You can remove such orphaned packages using autoremove
.
sudo apt autoremove
Clean Local Cache
If you want to completely wipe a package from your system, you’ll also want to clear out packages from the local cache. We’ll use autoclean
for this as it only removes package archives that are useless (outdated, or no longer present in the repo).
sudo apt autoclean
Check Package Status
Finally, you can verify that the package is removed with
apt policy packagename
Uninstall Packages from Software Center
The Ubuntu Software app lists most user-installed packages, as well as some preinstalled ones. You can’t manage libraries and dependencies through it which makes it somewhat limited. But it’s still an intuitive way to uninstall packages as it’s the default GUI package management method.
- Launch the Software Center from the dock. Or, search and open ‘Ubuntu Software’ from the Activities overview.
- Go to the Installed tab and click on Uninstall to remove the packages you want.
If you want to remove a locally installed package,
- Right-click the package file and select Open with another application.
- Select Software Install and press Enter. Then, click on the Uninstall button to remove the package.
Use Synaptic to Remove Packages
Synaptic is a popular graphical package manager that uses apt under the hood. It’s much more flexible compared to the earlier method as it lets you manage preinstalled libraries and dependencies as well.
sudo apt install -y synaptic
- Launch the Synaptic Package Manager and select the Status > Installed filter.
- You can also directly locate the package by searching the package name.
- Click on the package entry and select Mark for Removal. Then, press Apply to remove the marked packages.
Uninstall Packages using Dpkg
Apt is just a high-level frontend to dpkg. Dpkg is not as user-friendly as apt, but you can still use it to remove packages installed using apt or dpkg.
To uninstall a package, use the --remove
flag.
sudo dpkg -r packagename
If you want to remove the conf files as well, use the --purge
option instead,
sudo dpkg -P packagename
Uninstall Packages with Snap
Ubuntu is increasingly favoring snap over traditional package management methods like apt as snaps are secure and easy to install and maintain. If you want to list the packages installed as snaps, you can use
snap list
Then, you can remove the desired package with
sudo snap remove packagename
Uninstall Packages with Flatpak
Flatpak is a popular alternative to snap with its key selling points being up-to-date desktop packages, better performance, and package availability. To remove packages installed with Flatpak, first list them with
flatpak list --app
Uninstall the packages by specifying their app_id like so
flatpak uninstall app_id
flatpak uninstall org.videolan.VLC
Similarly, you can use the --unused
flag to remove orphaned libraries.
flatpak uninstall --unused
Remove Packages Compiled from Source
There are usually two scenarios when uninstalling a package built from source. If you used a tool like checkinstall
to compile the package, the package will be added to the database of installed packages. In this case, you can easily uninstall the package with
sudo apt remove packagename
If you used make install
to compile it instead, you’ll need to check the documentation provided by the developer for any uninstall instructions. Generally, you’ll be able to remove the package with
sudo make uninstall
If the developer hasn’t packaged any uninstall scripts, then you’ll have to search and delete all the files manually.