Categories: Ubuntu

How do I uninstall a package in Ubuntu?

While you work in the Linux environment, most applications or packages you found useful for solving your problems, but after trying these applications, you want to uninstall these packages from your system. It is an easier way to uninstall packages using the graphical interface. However, you should have basic knowledge about how to uninstall or remove a package from a Linux system using the command-line method.

In this tutorial, we will talk about how you uninstall a package in Ubuntu distribution using both methods: either using the GUI or by using the command-line environment.

Prerequisites

To uninstall or remove a package from the Ubuntu Linux system, you must have root privileges to run the terminal commands.

Methods
Sponsored
to uninstall a package in Ubuntu 20.04 system

Using the following two ways, you can uninstall a package from the Ubuntu 20.04 operating system:

  1. Uninstall a package from Ubuntu using the Terminal (Command-line method)
  2. Uninstall a package from Ubuntu using the GUI

Method 1: Uninstall a package using the Terminal (Command-line method)

Most Ubuntu Linux users prefer to use the command-line method to uninstall or remove an application from the Ubuntu system. The command-line method offers more control and options for uninstalling the packages.

List installed Ubuntu packages

It is necessary to know the exact package name to uninstall a software or package from your Ubuntu system. Therefore, in Ubuntu 20.04 system, you can view the installed packages by using the following command:

$ sudo apt list –installed

The above command displays the large list of installed packages on your system. but, it would be difficult to find the exact package name from the displayed, installed packages list. To view output in the more readable form, use the ‘less’ with the above command as follows:

$ sudo apt list –installed | less

Press enter to move on to the next package.

You can also search the exact package name from the whole list by using the grep command as follows:

$ sudo apt list –installed | grep package_name

For example, to find all ‘apache2’ packages, use the below-mentioned command:

$ sudo apt list –installed | grep apache2

Commands to remove a package using Terminal in Ubuntu

The following four most commonly used commands that help you to remove a software package or an application from the Ubuntu system:

Uninstall a package using the ‘remove’ command
To uninstall or remove a package from the Ubuntu system, use the ‘apt-get remove’ command followed by the package name as follows:

$ sudo apt-get remove package_name

You can also remove more than one package at the same time by using the following command syntax:

$ sudo apt-get remove package_name1 package_name2

For example, we want to uninstall ‘zip’ and ‘wget’ packages from the Ubuntu system. Use the below-mentioned command to uninstall these packages:

$ sudo apt-get remove zip wget

Uninstall package using ‘purge’ command
The ‘apt-get remove’ command removes the entire package from your Ubuntu system. But, it leaves some packages and configuration files behind on your system. However, to completely uninstall a package including all configuration files, use the ‘purge’ instead of executing the ‘remove’ command. The following ‘purge’ command is used to uninstall a package from the Ubuntu system completely:

Sponsored
$ sudo apt-get remove ––purge package_name

For example, to uninstall apache2 packages along with all configuration files from your system, use the below command:

$ sudo apt-get remove ––purge apache2

Uninstall unused packages
When you install an application on Ubuntu, it may also download and install the dependencies required to install the application properly. When you uninstall the required packages, the packages dependencies still linger in your system but are unused. These leftover or unused packages can remove from the Ubuntu system by executing the following command:

$ sudo apt autoremove

You can also clean the outdated/ old packages from the cache by running the below-mentioned command:

$ sudo apt-get clean

Uninstall snap packages
The snap package manager is a part of the new Ubuntu versions. So, when you independently uninstall a package using snap, you need a list of all installed snap packages. Using the below-given command, you can easily display the list of all installed snap packages:

$ snap list

Once the installed snap packages list is obtained, use the following command to uninstall the snap package:

$ sudo snap remove package-name

For example, to uninstall the ‘discord’ application from the snap list, use the following command:

$ sudo snap remove discord

Method 2: Uninstall a package from Ubuntu using the GUI

The alternative way to uninstall a package is using the Ubuntu software center. The software package manager is available on the left sidebar of your Ubuntu desktop. To access this application click the ‘Ubuntu software’ icon or launch it using the application search bar as follows:

The following Ubuntu software manager window shows on your system. Click on the ‘Installed’ tab to see all installed packages. Here, you can search for an application that you want to uninstall from your Ubuntu system.

Select the application that you want to remove from your Ubuntu machine as follows:

Conclusion

We learned different commands through which you can easily uninstall a package or software from your Ubuntu 20.04 system. Moreover, we also demonstrated how to remove or uninstall a package using the GUI of the Ubuntu software center. You can adopt any method from either uninstalling a package via command-line or using the GUI; these methods are useful for every Linux user.

Ubuntu Server Admin

Recent Posts

Ubuntu Weekly Newsletter 866

Welcome to the Ubuntu Weekly Newsletter, Issue 866 for the week of November 10 –…

1 hour ago

Ubuntu vs Debian: Linux Distributions Compared Deep Dive

Debian and Ubuntu are two popular Linux distributions. In this deep dive we will guide…

10 hours ago

How to Install Google Cloud BigQuery Python client library on Linux

In this article, we will see how to Install Google Cloud BigQuery Python client library…

3 days ago

Wallpaper Contest for Xfce 4.20 open for voting

Nov 15,2024 Wallpaper Contest for Xfce 4.20 open for voting The submission phase for the…

3 days ago

Canonical announces the first MicroCloud LTS release

MicroCloud 2.1.0 LTS is now available, expanding the number of Canonical infrastructure solutions with a…

3 days ago

Join Canonical in Paris at Dell Technologies Forum

Canonical is thrilled to be joining forces with Dell Technologies at the upcoming Dell Technologies…

4 days ago