6 Ways To Uninstall Packages in Ubuntu

Try this guide with our instant dedicated server for as low as 40 Euros

uninstall package in ubuntu

Even if you are a green novice with Ubuntu, you know that every software on the platform comes as a package. 

Understanding how to remove unnecessary packages efficiently and their configuration files can streamline your system’s performance, especially in Ubuntu server environments. 

Over time, uninstalling packages in Ubuntu becomes essential for managing disk space and ensuring your Ubuntu system remains clutter-free. 

In this tutorial, we will walk through the steps to uninstall a package in Ubuntu. We will discuss command-line and GUI-based methods, highlighting the importance of properly deleting the core files and dependencies.

Table Of Contents

  1. How to Uninstall Package in Ubuntu
    1. The Prerequisites
    2. Uninstall Packages in Ubuntu Using the CLI
    3. Uninstall Packages in Ubuntu Using the GUI
  2. Conclusion
  3. FAQs

How to Uninstall Package in Ubuntu

Ubuntu provides various methods for package removal, including graphical user interface (GUI) applications and terminal commands. But before that, let’s look at the prerequisites to the process.

The Prerequisites 

Before you begin, ensure you have the following:

  • A system running a stable Ubuntu version. Our test system has Ubuntu 20.04.
  • A user account with root or sudo privileges.

Uninstall Packages in Ubuntu Using the CLI

Ubuntu supports all Debian-based CLI package management tools, such as apt, dpkg, and snap. We will now discuss how you can use these tools to uninstall packages in Ubuntu. 

Option #1: Uninstall Ubuntu Packages with apt

apt is a popular package manager for Ubuntu systems. It offers an apt remove command that you can use to delete a specified package from the system.

Here’s the syntax of the apt remove command:

# sudo apt remove [package]

For instance, to uninstall Vim from Ubuntu, you would use the following command:

# sudo apt remove vim -y

sudo apt remove vim -y

While the apt remove command effectively uninstalls packages, it may leave behind configuration files. For a thorough cleanup, we recommend the apt purge command as an alternative. This option not only deletes the packages but also removes all associated dependencies, ensuring a thorough removal from the system.

The syntax of the apt purge command is as follows:

# sudo apt purge [package]

For instance, to remove Vim along with its configuration files, use:

# sudo apt purge vim -y


sudo apt purge vim -y

However, leftover dependencies from prior installations can sometimes linger on the system. To eliminate these unused dependencies and reclaim space, execute the apt autoremove command:

# sudo apt autoremove -y

sudo apt autoremove -y

The command eliminates any orphaned or superfluous dependencies.

The apt clean utility is handy for purging outdated package cache. Execute the following to clean out your Ubuntu system’s cache:

# sudo apt clean

Note that this command does not produce any output.

Option #2: Uninstall Ubuntu Packages with dpkg

The dpkg utility is one of the earlier package managers built for Debian-based systems, including Ubuntu. 

To remove a Debian package using this package manager, execute the following command:

# sudo dpkg -r [package]

For instance, to uninstall Vim, execute the following command:

# sudo dpkg -r vim

sudo dpkg -r vim

The dpkg package manager provides the -P option to uninstall packages along with all their dependencies:

# sudo dpkg -P [package]

For instance, remove Vim along with all its associated dependencies by using the following command:

# sudo dpkg -P vim

sudo dpkg -P vim

The command uninstalls the package and any associated configuration files from the system.

Option #3: Uninstall Ubuntu Packages with snap

Snap is perhaps the most recent software package and deployment platform for Ubuntu systems. 

Removing snap packages from Ubuntu is simple because snap encapsulates all dependencies within a single package. Consequently, when you remove a snap package from Ubuntu, it is a clean process that ensures the removal of all unused dependencies, configuration files, and related user data.

To uninstall packages on Ubuntu using the snap command, proceed with the following steps:

  • Display a list of all installed snaps by executing:

# snap list


  • Copy the name of the package you wish to remove.
  • Now, run the following command to uninstall the snap:

# sudo snap remove [package]

For example, remove lxd with the following command:

# sudo snap remove lxd

sudo snap remove lxd

The output verifies that the package has been successfully uninstalled.

Option #4: Uninstall Ubuntu Packages with Flatpak

If you use Flatpack to install packages on your Ubuntu system, use the following steps to remove flatpak packages:

  • Start by displaying all installed flatpak packages and the corresponding IDs:

# flatpak list --app

  • Select and copy the identifier (ID) of the package you wish to remove.
  • Proceed to remove the package by utilizing the following command:

# flatpak uninstall [app_id]

Additionally, over time, unused runtime libraries pile up. You should occasionally remove these unused runtimes by running the flatpak uninstall command with the –unused option:

# flatpak uninstall --unused

To remove all Flatpak applications, execute the following command:

# flatpak uninstall --all

Uninstall Packages in Ubuntu Using the GUI

Ubuntu users who favor using a graphical interface for package management have two options for removing packages from the system. 

The Ubuntu Software Center serves as the primary GUI-based package manager. Alternatively, you can opt for another GUI-based option for uninstalling packages from your Ubuntu system. 

Option #1: Uninstall Packages with Ubuntu Software Manager

In Ubuntu environments, the primary tool for managing software is the Ubuntu Software Center. We recommend the following steps to remove a package with this tool:

  • Launch the Ubuntu Software Center.
  • Choose the Installed tab.
  • Navigate through the program list and locate the one you wish to remove.
  • Select the Uninstall option for the program.

Option #2: Use the Synaptic Package Manager

Although it’s not as popular as the Ubuntu Software Manager, the Synaptic Package Manager remains the package manager of choice for Ubuntu users because of its dependable performance.

We recommend the following steps to remove packages with Synaptic:

  • Launch Synaptic and choose Status > Installed from the left-side menu.
  • Identify the application you wish to uninstall.
  • Bring up the context menu and choose Mark for Removal or Mark for Complete Removal to eliminate the software and its default configuration files.
  • Click Apply.

Now that you have a comprehensive idea of uninstalling packages from Ubuntu systems, we recommend you our tutorials on installing RPM packages on Ubuntu. Alternatively, you can opt to install DEB packages on Ubuntu.  


Uninstalling packages in Ubuntu is a streamlined process that can be efficiently executed through the command line interface or the Ubuntu Software applications menu. 

Whether you’re a root user managing a server hosted by providers like Redswitches or simply looking to declutter your Linux system by removing unused packages, the tools provided by Ubuntu make it easy to identify and eliminate unneeded packages. 

From individual packages like the apache2 package to entire package repositories, the command line methods, including the apt install and apt autoremove commands, offer precision in targeting the exact package you want to uninstall.

These methods ensure that your package index remains clean and free from the clutter of installed packages that are no longer in use. 

By leveraging these capabilities, users can maintain an efficient and optimized system, ensuring that only the necessary package files remain, thereby enhancing the overall performance and security of their Linux environment.

We offer the best dedicated server pricing and deliver instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.


Q. What is the easiest way to uninstall a package from Ubuntu Linux?

The easiest way is to use the Ubuntu Software Center, where you can find the application packages installed on your Ubuntu machine and select the one you want to remove.

Q. How can I list all packages installed on my Ubuntu system to find the package I want to uninstall?

You can use the terminal command apt list –installed to get a list of installed packages on your system, helping you identify the specific package installed.

Q. Can I uninstall a package using the terminal in Ubuntu Linux?

Yes, using the terminal is a common way for Linux users to uninstall packages. You can use sudo apt-get remove package_name to uninstall a package, where package_name is the name of the package you want to remove.

Q. Is there a way to uninstall a package and its dependencies in Ubuntu?

Yes, you can use the sudo apt-get autoremove package_name command, which not only uninstalls the package but also removes extra packages and dependencies that are no longer needed.

Q. How can I uninstall a package and also delete its configuration files in Ubuntu?

To uninstall a package and remove its configuration files, you can use the sudo apt-get purge package_name or apt –purge remove package_name command. This ensures that all the package’s archive files and configuration settings are also deleted.

Q. What should I do if I want to uninstall multiple packages at once on my Ubuntu machine?

You can uninstall multiple packages by listing them all in a single command after sudo apt-get remove, separating each package name with a space.

Q. How can I find out if a specific package is installed on my Ubuntu system before I attempt to uninstall it?

Use the apt list –installed | grep package_name command, replacing package_name with the name of the package you’re looking for, to see if it’s installed on your system.

Q. Is there a way to view a history of package installations and uninstallations on my Ubuntu system?

Yes, you can view the history of package management by checking the log files located in /var/log/apt/, such as history.log, which will show you a record of installed and uninstalled packages.

Try this guide with our instant dedicated server for as low as 40 Euros