How to Uninstall Ubuntu Packages? (Remove Packages in Ubuntu)

When working in a Linux environment like Ubuntu, you may frequently install applications to test their functionality. However, after some time, you might want to remove certain packages that are no longer useful. While Ubuntu provides a graphical interface for uninstalling applications, knowing how to remove packages using the command line is crucial for efficient system management.

This guide explores two methods for how to remove packages in Ubuntu: using the command-line terminal and the graphical user interface (GUI).

Prerequisites

Before uninstalling a package, ensure you have the necessary administrative privileges. Running commands in the terminal requires root access, which can be granted using the sudo command.

Methods to Uninstall Ubuntu Packages (Remove Packages in Ubuntu)

There are two main ways to uninstall Ubuntu packages from your system:

  1. Using the Terminal (Command-line Method)
  2. Using the Graphical User Interface (GUI)

Let's explore both methods in detail one by one.

Method 1: Uninstall Ubuntu Package Using the Terminal

Most Linux users prefer the command-line method because it provides greater control over package management. Follow these steps to uninstall Ubuntu package using the terminal:

Step 1: List Installed Packages

Before uninstalling a package, you need to know its exact name. Use the following command to list all installed packages:

$ sudo apt list --installed

how to uninstall ubuntu packages? (remove packages in ubuntu)

Since the list can be extensive, you can filter the results to find a specific package using:

$ sudo apt list --installed | grep package_name

For example, to check if apache2 is installed:

$ sudo apt list --installed | grep apache2

how to uninstall ubuntu packages? (remove packages in ubuntu)

Alternatively, use less to navigate the package list efficiently:

$ sudo apt list --installed | less

Press Enter to move to the next entry.

Step 2: Uninstall Ubuntu Packages

Once you have identified the package name, use one of the following commands to remove it.

1. Using remove Command (apt remove package)

To uninstall a package but keep its configuration files, use:

sudo apt remove package_name

To remove multiple packages at once:

sudo apt-get remove package1 package2

For example, to uninstall zip and wget:

$ sudo apt remove zip wget

how to uninstall ubuntu packages? (remove packages in ubuntu)

2. Using purge Command

The remove command does not delete configuration files. To completely remove a package along with its configuration files, use:

sudo apt-get remove --purge package_name

For example, to completely remove apache2:

sudo apt remove --purge apache2

how to uninstall ubuntu packages? (remove packages in ubuntu)

3. Removing Ubuntu Packages Using DPKG

DPKG is a low-level package management tool used in Debian-based systems like Ubuntu. You can use it to remove installed packages directly.

To uninstall a package using DPKG, run the following command:

$ sudo dpkg -r [package_name]

For instance, to remove VLC Media Player, use:

$ sudo dpkg -r vlc

This command removes the package but may leave behind configuration files.

To completely remove a package along with its configuration files, use the -P (purge) option:

$ sudo dpkg -P [package_name]

For example, to fully remove VLC, including its configuration files:

$ sudo dpkg -P vlc

This ensures the package and all its related settings are completely deleted from the system.

4. Uninstall Ubuntu Packages using Snap

Ubuntu also supports snap packages, which are managed differently than traditional apt packages. To list installed snap packages, use:

$ snap list

how to uninstall ubuntu packages? (remove packages in ubuntu)

Once you find the package name, uninstall it with:

$ sudo snap remove package_name

For example, to remove bare:

$ sudo snap remove bare

5. Uninstall Ubuntu Packages Using Flatpak

Flatpak is a package management tool that provides a standardized way to install and manage applications on Linux distributions. Follow these steps to remove Flatpak applications from your system:

List Installed Flatpak Applications

To view all installed Flatpak applications along with their application IDs, run:

flatpak list --app

Identify the Application ID

Find the application you want to remove from the list and note its corresponding ID.

Uninstall the Application

Use the following command to remove a Flatpak application:

sudo flatpak uninstall [application-id]

For instance, to uninstall the Spotify Flatpak package, run:

sudo flatpak uninstall com.spotify.Client

Remove Unused Runtimes

Flatpak stores runtime libraries that applications depend on, and over time, unused runtimes accumulate. To remove them, use:

flatpak uninstall --unused

Remove All Flatpak Applications

If you want to remove all Flatpak applications from your system, use:

flatpak uninstall --all

This command deletes all Flatpak-installed applications and their associated files.

Step 3: Remove Unused Dependencies

When a package is installed, Ubuntu also installs its dependencies. After uninstalling a package, some dependencies might remain on your system. To remove these unused packages, run:

$ sudo apt autoremove

how to uninstall ubuntu packages? (remove packages in ubuntu)

To clean outdated or old package cache files, use:

$ sudo apt clean

Or 

$ sudo apt-get clean

Can You Use ‘apt uninstall package’ or ‘apt delete package’ to Remove Packages in Ubuntu?

Many users mistakenly try to use the command apt uninstall package_name or apt delete package, but this is incorrect. Ubuntu does not support uninstall as a command within apt. Instead, use:

$ sudo apt remove package_name

Method 2: Uninstall Ubuntu Packages Using the GUI

If you prefer a graphical interface, uninstall Ubuntu packages using the Ubuntu Software Center. Follow these steps:

Step 1: Open Ubuntu Software Center

  • Click the Ubuntu Software icon from the left sidebar.
  • If not visible, search for "Ubuntu Software" in the application menu and open it.

how to uninstall ubuntu packages? (remove packages in ubuntu)

Step 2: Navigate to Installed Applications

  • Click the Installed tab.
  • A list of installed applications will appear.

Step 3: Uninstall Ubuntu Package

  • Locate the package you want to uninstall.
  • Click on the package name to open its details.
  • Click Remove to uninstall the package.
  • Enter your password if prompted.

Once completed, the package is removed from your system.

Conclusion

In this guide, we learned how to uninstall Ubuntu packages, including the command-line approach using apt-get remove, purge, and autoremove commands, and removing Snap packages with snap remove

Additionally, we explored the GUI method using the Ubuntu Software Center for those who prefer a visual interface. While both methods are effective, the command-line approach offers greater flexibility and control, whereas the GUI is more beginner-friendly. Regardless of the method you choose, always verify the package details before removal to prevent unintended system issues.

Experience high-performance VPS hosting with the reliability of the cloud at BlueVPS. Offering a powerful, scalable, and fully customizable environment, our VPS solutions provide the flexibility you need to run your applications seamlessly. Enjoy a dedicated hosting experience with unlimited traffic, ensuring uninterrupted performance for your business. Take control of your hosting with unmatched speed, security, and scalability—only at BlueVPS.com!

Blog