- How can you completely remove a package?
- 10 Answers 10
- How to Uninstall Packages in Ubuntu
- How to Uninstall Packages in Ubuntu
- Uninstall Packages in Ubuntu Using the CLI
- Option 1: Uninstall Ubuntu Packages with apt
- Option 2: Uninstall Ubuntu Packages with dpkg
- Option 3: Uninstall Ubuntu Packages with snap
- Option 4: Uninstall Ubuntu Packages with Flatpack
- Uninstall Packages in Ubuntu Using the GUI
- Option 1: Uninstall Packages with Ubuntu Software Manager
- Option 2: Use the Synaptic Package Manager
- How to Remove Packages from Ubuntu & Debian
- How to Remove Packages via Command Line
- Using remove option:
- Using purge option:
- Using clean option:
- Using autoremove option:
- Uninstall Packages via Graphical Interface
- Conclusion
How can you completely remove a package?
I am trying to do a clean install of the octave3.2 package. To do this, I removed it, then tried to reinstall it. When I reinstalled, an error occurred. It could be a bug in the package, but I want to make sure I have everything removed so that I can do a clean install. Is it enough to do this?
sudo apt-get --purge remove octave3.2
10 Answers 10
This is a very general answer to the question about the effects of purging packages. For advice specific to your situation, you’ll have to edit your question to include additional information—in particular, the complete and exact text of the error message you are getting.
Removing packages with sudo apt purge . or sudo apt —purge remove . will remove them and all their global (i.e., systemwide) configuration files. This is usually what people mean when they talk about completely removing a package.
But that doesn’t mean your system is the same as it was before the package was installed. In particular:
- This does not remove packages that were installed as dependencies, when you installed the package you’re now removing. Assuming those packages aren’t dependencies of any other packages, and that you haven’t marked them as manually installed, you can remove the dependencies with sudo apt autoremove or (if you want to delete their systemwide configuration files too) sudo apt —purge autoremove .
- This does not remove non-systemwide configuration files. Specifically, it does not remove user-specific configuration:
- It does not remove the configuration files and directories located in users’ home directories (or in the .config subdirectory of their home directories), created by the software the package provides.
- If these files/folders are not stored in .config , they usually start with a . themselves. Either way, you can see them with ls by using the -a or -A flag, and you can see them in Nautilus and most other file browsers/managers by pressing Ctrl + H or going to View >Show Hidden Files.
How to Uninstall Packages in Ubuntu
During software installation, package managers often download additional packages (dependencies). While necessary for the installation, these packages stay on the system, hindering performance and taking up storage space.
This guide teaches you how to uninstall packages in Ubuntu using the command line or GUI.
- Ubuntu system (this tutorial uses Ubuntu 20.04).
- A user account with sudo privileges.
- Access to the terminal.
How to Uninstall Packages in Ubuntu
Ubuntu offers different ways to uninstall packages. Users can remove software using apps available in the graphical user interface (GUI) or through the terminal.
Uninstall Packages in Ubuntu Using the CLI
The primary package managers on Ubuntu are apt, dpkg, and snap. Each utility offers several ways to uninstall unwanted software. The following sections provide in-depth instructions.
Option 1: Uninstall Ubuntu Packages with apt
Ubuntu comes with the apt package manager by default. The utility offers several levels of removing unwanted packages from the system. The apt remove command deletes any specified package:
For instance, remove Vim from Ubuntu with:
Note: Adding the -y argument to the command auto-approves all queries during the uninstallation process.
However, the apt remove command does not remove configuration files. To clear packages from the system completely, use apt purge . The purge option deletes packages and removes all dependencies:
This command deletes the software entirely from the system. For instance, delete Vim and config files with:
Still, unnecessary dependencies sometimes remain on the system from previous installations. To get rid of unused dependencies and free up space, run :
The command removes all orphaned or unnecessary dependencies.
An apt utility for removing outdated packages’ cache is apt clean . To clear the cache from an Ubuntu system, run:
The command prints no output.
Option 2: Uninstall Ubuntu Packages with dpkg
The dpkg utility is another package manager used in Debian-based systems, such as Ubuntu. To uninstall a Debian package, run:
For instance, to remove Vim, run:
The dpkg package manager also allows users to remove packages and all dependencies with the -P option:
For example, purge Vim and all dependencies with:
The command removes a package and any configuration files from the system.
Option 3: Uninstall Ubuntu Packages with snap
Although newer than apt, snap is a popular software package and deployment system. Uninstalling snap packages on Ubuntu is straightforward, as snap packs all the dependencies into a single package. This means that snap remove deletes the software entirely from the system, including config files and all associated user data.
To remove Ubuntu packages with the snap command, follow the steps below:
1. List all installed snaps with:
2. Note the name of the package to delete.
3. To delete an installed snap, execute:
The output confirms that the package is removed.
Option 4: Uninstall Ubuntu Packages with Flatpack
To uninstall Flatpack packages:
1. List all apps and their ID with:
2. Copy-paste the ID of the app you want to uninstall.
4. Also, unused runtime libraries accumulate over time. To delete unused runtimes, use the —unused option:
5. If you wish to delete all Flatpack apps, use:
Note: Learn about the differences between Flatpak, Snap and AppImage.
Uninstall Packages in Ubuntu Using the GUI
Ubuntu users who prefer managing packages in a GUI have two ways to uninstall software. The Ubuntu Software Center is the standard package manager, but there is also an alternative.
Option 1: Uninstall Packages with Ubuntu Software Manager
The default software manager for Ubuntu GUI users is Ubuntu Software Center. To uninstall a package using this utility, take the following steps:
1. Open Ubuntu Software Center.
2. Select the Installed tab.
3. Scroll down the list of programs and find the one to uninstall.
4. Click the Uninstall button next to the program.
Option 2: Use the Synaptic Package Manager
While not as commonly used anymore, the Synaptic Package Manager is still the preferred package manager among certain Ubuntu users due to its robust build.
To uninstall packages using Synaptic:
1. Start by launching Synaptic.
2. From the menu on the left select Status > Installed.
3. Highlight the application you want to remove.
5. Select Mark for Removal or Mark for Complete Removal to delete the standard configuration files along with the software package.
6. Click Apply.
Now you have a good understanding of several ways to remove packages on Ubuntu Linux. Next, learn how to list all installed packages in Ubuntu.
How to Remove Packages from Ubuntu & Debian
The APT (Advanced Package Tool) is a powerful package management tool for Debian based systems. It provides powerful command-line tool like “apt” or “apt-get”. Which is used to install, upgrade or remove a software package on your Debian system.
In this tutorial, you will learn to how to uninstall or remove packages from a Ubuntu or Debian Linux system.
How to Remove Packages via Command Line
You can use “apt” command line tool for removing packages from your system. For older version of operating systems use “apt-get” command with the same options.
Use one of the below options to remove, purge packages from system. Clean the cache files to remove unused software’s from the system.
Using remove option:
To remove a specific package, use the apt remove command:
sudo apt remove [package-name]
This command prompts apt to scan through the installed applications and attempt to remove or repair any that are broken.
Using purge option:
The default remove command only deletes the software files from the system, but keep all the configuration files for safety purpose. In case of accidental deletion the configuration and data files are safe.
If you want to completely remove all the data, application and configuration files, use –purge option with the above command. like:
sudo apt remove ––purge [package-name]
Using clean option:
Use this option with apt to delete all the cache files of deleted software from your system.
Also removes the apt package manager cache from system.
Using autoremove option:
Most of the software’s installed the dependent packages on your system. Which you can see during the installation of any software on your system. But they still remains on your system after removing the original package your installed.
With the help of this command, you can remove orphaned dependencies from system
Any users don’t feel comfert with command line can use the graphical interface to remove packages from system.
Uninstall Packages via Graphical Interface
The Desktop users can remove packages using the Ubuntu software center. The Ubuntu software center provides you a graphical interface for installation, update and removal of the packages from system.
Search for the Ubuntu software center under the applications and launch it.
Go to the installed tab. Here you will find a list of all packages installed on your Ubuntu system. Find your package and click “Remove” button in front of the package name. See below image:
A confirmation dialog will appear here. Again click click to complete deletion.
You may prompted for a sudo password of your account to complete the package removal process.
Conclusion
This tutorial describes a several ways to remove packages from a Ubuntu Linux systems.
- It does not remove the configuration files and directories located in users’ home directories (or in the .config subdirectory of their home directories), created by the software the package provides.