If there's software on your Ubuntu Linux system that you wish to remove, there are a few ways to go about uninstalling the associated packages.

In this guide, we'll take you through the step by step instructions for uninstalling a package on Ubuntu from both GUI and command line. We'll also show you options for deleting or keeping the configuration files that are associated with a package. Use whichever method below that you find most convenient for your situation.

In this tutorial you will learn:
  • How to uninstall a package via GNOME GUI
  • How to uninstall a package via command line
  • How to uninstall a snap package
  • How to uninstall unused packages
Uninstalling a package on Ubuntu
Uninstalling a package on Ubuntu
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu Linux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Uninstall a package via GNOME GUI


SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


The default desktop environment for Ubuntu is GNOME. Thus, these instructions and screenshots will be specifically tailored to those running GNOME. If you're using a different desktop environment, the process should be quite similar but the menus will look a little different.

  1. Open the "Ubuntu Software" application from GNOME's app launcher.

    Locate the Ubuntu Software utility
    Locate the Ubuntu Software utility
  2. To access a full list of installed applications, click on the "Installed" tab at the top. In this menu, you'll be able to click "Remove" on any application that wish to uninstall.

    Use this menu to remove any listed package
    Use this menu to remove any listed package

Note that the Ubuntu Software app typically only lists applications that were installed via GUI or apps that have a GUI themselves. You also can't remove system applications from this menu. For more advanced control over all the packages on your system, it's recommended to use the command line approach covered below.

Uninstall a package via command line

There are actually three different commands that can be used to remove a package from Ubuntu. Two of those are apt and apt-get, and the other one is dpkg. Opting to use apt for removing packages is the most recommended approach, but for the sake of completeness, we'll cover all methods.

  1. First, you'll need to know the name of the package you want to remove. Use one of the commands below to get a list of all the packages on your system. Pipe to grep if you have some idea of how the package might be named.
    $ apt --installed
    OR
    $ dpkg -l
    


  2. Once you have the name of the package, use apt or one of the other commands to remove it.
    $ sudo apt remove package-name
    OR
    $ sudo apt-get remove package-name
    OR
    $ sudo dpkg -r package-name
    
  3. Any of the above commands will remove the specified package, but they will leave behind configuration files, and in some cases, other files that were associated with the package. To remove those as well, you need to "purge" the package. You can do this either after removing a package or instead of removing a package (purging automatically implies removing as well).
    $ sudo apt purge package-name
    OR
    $ sudo apt-get purge package-name
    OR
    $ sudo dpkg -P package-name
    

Uninstall a Snap package

The Snap package manager is somewhat new but it's part of all newer versions of Ubuntu. It works independently of apt, so uninstalling software that was installed as a Snap package will require a separate command.

  1. To see a list of installed Snap packages on your system, execute the following command in terminal.
    $ snap list
    


  2. After you've obtained the exact name of the package you wish to remove, use the following command to uninstall it.
    $ sudo snap remove package-name
    

Uninstall unused packages

While installing some software, your package manager may download dependencies that are required to install a package properly. When it finishes installing a package, these dependencies will linger on your system but be unused. Therefore, it's recommended to run the following command occasionally to remove any unused packages from your system.

$ sudo apt autoremove

Conclusion

In this guide, we learned how to uninstall a package in Ubuntu from both GUI and command line. The GUI method can be more convenient for some users but its power pales in comparison to the command line method. For the command line, it's recommended that you stick to the apt command, as apt-get is more for system scripts and dpkg doesn't handle dependencies as well as apt does.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions