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
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:
sudo apt remove [package]
For instance, remove Vim from Ubuntu with:
sudo apt remove vim -y
Note: Adding the
-y argument to the command auto-approves all queries during the uninstallation process.
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:
sudo apt purge [package]
This command deletes the software entirely from the system. For instance, delete Vim and config files with:
sudo apt purge vim -y
Still, unnecessary dependencies sometimes remain on the system from previous installations. To get rid of unused dependencies and free up space, run :
sudo apt autoremove -y
The command removes all orphaned or unnecessary dependencies.
apt utility for removing outdated packages' cache is
apt clean. To clear the cache from an Ubuntu system, run:
sudo apt clean
The command prints no output.
Option 2: Uninstall Ubuntu Packages with dpkg
dpkg utility is another package manager used in Debian-based systems, such as Ubuntu. To uninstall a Debian package, run:
sudo dpkg -r [package]
For instance, to remove Vim, run:
sudo dpkg -r vim
The dpkg package manager also allows users to remove packages and all dependencies with the
sudo dpkg -P [package]
For example, purge Vim and all dependencies with:
sudo dpkg -P vim
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:
sudo snap remove [package]
For example, remove FFmpeg with:
sudo snap remove ffmpeg
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:
flatpak list --app
2. Copy-paste the ID of the app you want to uninstall.
3. Uninstall an app using:
flatpak uninstall [app_id]
4. Also, unused runtime libraries accumulate over time. To delete unused runtimes, use the
flatpak uninstall --unused
5. If you wish to delete all Flatpack apps, use:
flatpak uninstall --all
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.
4. Right-click the app.
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.