- 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 uninstall package on Ubuntu
- Uninstalling Package Using Software Center of Ubuntu
- Uninstalling Package on Ubuntu Using Command Line
- Conclusion
- About the author
- Alishba Iftikhar
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 uninstall package on Ubuntu
Are you a new Ubuntu user and facing storage problems and want to delete unnecessary packages then you are in the right place. Ubuntu allows you to install and uninstall the package by both graphical user interface and command line interface.
A “package” is a compressed file archive that contains all of the files that come with a given application in Linux distributions. New software for Linux-based PCs is delivered and maintained by a package. Executable installers are used in the same way as executable installers are used on Windows-based machines.
In this article two ways to uninstall a package from the Ubuntu system are discussed. You can follow any of the two according to your requirements.
Uninstalling Package Using Software Center of Ubuntu
Software center is like the App store of Apple and allows you to install and uninstall packages. If you are a new user and find the command line difficult then you can uninstall the package through the software center if it’s installed by Ubuntu software center.
Step 1: Open Ubuntu Software Center
Click on icon of Software Center from the list of icons on left side of Ubuntu screen:Step 2: Open installed apps
Click on installed tab on Ubuntu software center:Step 3: Remove Package/App
Now you can remove any package which is present in installed packages of Ubuntu software center. I am removing Document Scanner from installed packages by clicking on the “Remove” button in front of package to be removed:A dialogue box will appear, click on Remove:
Uninstalling Package on Ubuntu Using Command Line
Some installed packages are not available in “installed packages” of Ubuntu software center so we can remove them using the terminal. There are three ways to remove package using command Line:
Uninstalling Package using “apt” : The best way is to use the “apt” command to remove packages.
The apt( Advance Packaging Tool) is the default package manager of Ubuntu.
Set the package-name which you want to remove.
Example: Run the below mentioned command to remove “nodejs” package from Ubuntu system:
In place of “nodejs” write the name of the package you want to remove.
Uninstalling Package Using “dpkg”: We can also remove package from system using dpkg command, dpkg is a Debian package manager that allows you to install, build, uninstall, and manage packages:
Change “package-name” according to your requirement.
Example: Run the below mentioned command to remove “make” package from Ubuntu system:
In place of “make” write the name of the package you want to remove.
Uninstalling Package using “snap”: Although the Snap package manager is very new, it is included in all current Ubuntu editions. To uninstall packages, which were installed as snap packages you need to run the snap command which works independent of apt command. The syntax is given below:
Set “package-name” which you want to remove.
Example: Run the below mentioned command to remove “rocketchat-server” package (which is installed as snap package) from Ubuntu system:
In place of “rocketchat-server” write the name of the package you want to remove.
Uninstalling unnecessary Packages : Your package management may download dependencies that are required to correctly install a package while installing some software. These dependencies will remain on your system after it finishes installing a package, but they will be unused. As a result, it’s a good idea to run the following command on a regular basis to clear out any unwanted packages from your system.
Run the below mentioned command to remove unused packages:
Conclusion
To free up the space occupied by some unused packages, Ubuntu allows you to remove these unnecessary packages from your system. In this article we discussed in detail how to uninstall unwanted packages using the Ubuntu software center and using the command line in which commands are discussed to remove packages from the system; using apt, dpkg and snap. Read the article carefully to uninstall unnecessary packages from your Ubuntu system.
About the author
Alishba Iftikhar
I am currently an undergraduate student in my 1st year. I am an internee author with Linuxhint and loved learning the art of technical content writing from senior authors. I am looking forward to opting my career as a full time Linux writer after I graduate.
- 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.