Comprehensive Guide On How To Uninstall Software In Ubuntu: Terminal And GUI Methods

Comprehensive Guide On How To Uninstall Software In Ubuntu: Terminal And GUI Methods

How to Uninstall Docker Ubuntu?

Effectively uninstalling applications in Ubuntu requires a nuanced understanding of package managers like APT, Snap, and Flatpak to ensure the removal of both binary files and residual configurations. By utilizing commands such as sudo apt purge and sudo apt autoremove, users can maintain a lean system architecture, typically reclaiming significant disk space and resolving dependency conflicts that degrade OS performance.


System Requirements and Package Identification Framework

Before initiating any software removal process, it is critical to establish the environment's state and identify the exact nomenclature used by the system to reference the target software. Ubuntu utilizes several concurrent package management systems, and applying the incorrect removal protocol to a specific package type will result in an "Unable to locate package" error or leave significant orphaned data on the storage drive.

To ensure a successful uninstallation, the following prerequisites and identification steps are mandatory:



  • Administrative Privileges: You must have sudo (SuperUser Do) access or be logged in as the root user. Most uninstallation commands modify system directories like /usr/bin, /etc, and /var/lib, which are protected against standard user modifications.
  • Package Name Verification: Software names in Ubuntu are often different from their marketing names. For instance, the "GIMP" image editor is often referenced as gimp in the repository, but more complex software may have version-specific suffixes.
  • Active Package Inventory: Use the command dpkg --list to view all currently installed Debian packages, or snap list for applications installed via the Snap Store. This prevents syntax errors during the execution phase.
  • Estimated Duration: Standard application removal takes between 30 to 90 seconds. However, purging large suites like LibreOffice or complex database engines may require 3 to 5 minutes to process dependency trees and clear cache entries.
  • Dependency Awareness: Understand that removing one package may trigger the removal of others that rely on its libraries. Always review the "The following packages will be REMOVED" list provided by the terminal before confirming with "Y".

Advanced Methodologies for Software Removal and System Optimization

Ubuntu offers multiple pathways for uninstallation, ranging from user-friendly graphical interfaces to high-precision terminal commands. The terminal remains the most authoritative method, as it provides granular control over configuration files and shared libraries that graphical tools often overlook.



Step 1: Executing Standard APT Uninstallation and Purging

The Advanced Package Tool (APT) is the primary engine for managing Debian-based software. There is a vital distinction between a standard removal and a purge. A standard removal deletes the executable binaries but leaves configuration files intact in case you reinstall the software later. A purge removes everything, including system-wide configuration files.



  1. Open the Terminal by pressing Ctrl+Alt+T on your keyboard.
  2. To remove the software while keeping configurations, type sudo apt remove package_name and press Enter. Replace "package_name" with the actual name of the software.
  3. To completely wipe the software and its settings from the system, use the command sudo apt purge package_name. This is the recommended path for troubleshooting broken software.
  4. After the process completes, it is standard industry practice to run sudo apt autoremove. This command scans the system for "orphaned" dependencies—libraries that were originally installed to support the software you just deleted but are no longer needed by any other application.
  5. Finally, execute sudo apt clean to clear the local repository of retrieved package files, further optimizing disk space.

Warning: Be extremely cautious when using the purge command on core system components or desktop environment elements (like gnome-shell), as this can lead to a non-functional graphical interface or an unbootable system.



Step 2: Managing and Removing Snap Packages

Snap packages are containerized software packages designed by Canonical. They include all their own dependencies, which means they do not interfere with the rest of the system libraries, but they require a different uninstallation command than APT.



  1. Identify the installed snaps by typing snap list in the terminal.
  2. Execute the removal by typing sudo snap remove package_name.
  3. Unlike APT, Snaps typically handle their own cleanup, but a "snapshot" of the user data is often saved for 31 days. To remove a snap without saving a data snapshot, append the flag --purge to the command, resulting in sudo snap remove package_name --purge.
  4. Verification of removal can be confirmed if the package no longer appears in the output of the snap list command.


Step 3: Eliminating Flatpak Applications

Flatpaks are another form of sandboxed applications popular in the Linux community, often used for the latest versions of desktop software. If you have installed software via Flathub, use the following procedure:



  1. List all installed Flatpaks using the command flatpak list --app.
  2. Remove the specific application by typing flatpak uninstall application_id. Note that Flatpaks use a reverse-DNS naming convention, such as org.gimp.GIMP.
  3. To remove unused runtime libraries that Flatpaks leave behind, execute flatpak uninstall --unused. This is the Flatpak equivalent of the APT autoremove command and is essential for preventing "disk bloat."


Step 4: Graphical User Interface (GUI) Uninstallation

For users who prefer a visual approach, the Ubuntu Software Center (or the "App Center" in newer versions) provides a simplified workflow. This method is effective for basic desktop applications but may fail to remove complex system-level dependencies.



  1. Click on the "Show Applications" icon (the grid in the bottom left or dock).
  2. Search for and open "Ubuntu Software" or "App Center."
  3. Navigate to the "Installed" or "Manage" tab at the top of the window.
  4. Scroll through the list of applications until you find the target software.
  5. Click the "Uninstall" button or the "Trash" icon next to the application name.
  6. A prompt will appear asking for your system password to authorize the change. Enter it and wait for the progress bar to complete.

Pro-Tip: If an application appears in the GUI but the "Uninstall" button is greyed out, it is likely a core system component. In such cases, use the terminal method to investigate the package's priority before attempting a forced removal.


How To Remove Software In Ubuntu 22.04 LTS [ All Ubuntu Version ...

How To Remove Software In Ubuntu 22.04 LTS [ All Ubuntu Version ...

Package Management System Technical Comparison

The following table compares the primary uninstallation characteristics of the three major package systems found in Ubuntu. Selecting the correct tool depends on how the software was originally provisioned.



Feature APT (Debian) Snap (Canonical) Flatpak (Freedesktop)
Primary Command sudo apt remove sudo snap remove flatpak uninstall
Dependency Handling Shared system libraries Bundled internally Shared runtimes
Config Removal Manual (via purge) Automatic (unless snapshot) Manual user-data cleanup
Orphan Cleanup sudo apt autoremove Automatic flatpak uninstall --unused
Isolation Level Low (System-wide) High (Strictly Confined) High (Sandboxed)
Best For Drivers, Kernels, CLI Desktop Apps, Servers Modern Desktop Apps

Resolving Package Database Conflicts and Broken States

Occasionally, the uninstallation process may fail due to interrupted power, conflicting versions, or locked databases. Addressing these requires manual intervention in the package management metadata.

Scenario 1: The "Unable to lock the administration directory" Error



  • Root Cause: Another process (like an automatic update or another terminal window) is currently using the APT database lock file located at /var/lib/dpkg/lock-frontend.
  • Actionable Fix: Close all other software management tools. If the error persists, check for stuck processes using ps aux | grep apt. As a last resort, remove the lock file manually using sudo rm /var/lib/dpkg/lock-frontend followed by sudo dpkg --configure -a to repair the database state.

Scenario 2: Package is in a "Broken" State



  • Root Cause: A previous installation or removal was interrupted, leaving the package metadata in an inconsistent state where it is neither fully installed nor removed.
  • Actionable Fix: Run the command sudo apt --fix-broken install. This command attempts to satisfy missing dependencies or finish the installation/removal logic. Once complete, retry the sudo apt remove command.

Scenario 3: Residual Configuration Files Persist After Removal



  • Root Cause: Using the "remove" command instead of "purge" leaves files in /etc or hidden directories in the user's home folder.
  • Actionable Fix: Use the command dpkg -l | grep ^rc to find packages that are removed but still have configuration files. To clear these, use sudo apt purge $(dpkg -l | grep ^rc | awk '{print $2}'). For user-specific settings, manually delete the corresponding folders in ~/.config or ~/.local/share.

Frequently Asked Questions



How do I uninstall a PPA (Personal Package Archive) in Ubuntu?

To remove a PPA, use the command sudo add-apt-repository --remove ppa:user/ppa-name. To go a step further and downgrade all packages installed from that PPA to the official Ubuntu versions, install and use the ppa-purge utility with the command sudo ppa-purge ppa:user/ppa-name.



Does uninstalling an app remove my personal documents?

Standard uninstallation via APT, Snap, or Flatpak typically removes the application files and system-wide configurations but leaves your personal data (documents, saved games, or browser profiles) in your home directory. You must manually delete these hidden folders if you want a complete data wipe.



What is the difference between apt-get and apt for uninstallation?

The apt command is a modern, more user-friendly interface designed for interactive use, providing progress bars and simplified syntax. The apt-get command is an older, more stable backend tool often used in scripts. For uninstallation, sudo apt remove and sudo apt-get remove perform the same fundamental task.



How can I find the exact name of a package I want to uninstall?

If you are unsure of the name, use the search function with apt search keyword. For example, apt search chrome will return all packages related to Chrome, allowing you to identify the specific package name like google-chrome-stable for uninstallation.



Can I uninstall Ubuntu's default pre-installed applications?

Yes, most pre-installed apps like LibreOffice, Thunderbird, or Mines can be removed using the sudo apt purge command. However, be cautious when removing system utilities like Python or Netplan, as these are foundational to the operating system's functionality and network connectivity.

Optimize Your Ubuntu System Performance

Mastering the various package managers ensures your Linux environment remains efficient, secure, and free of unnecessary software bloat. If you frequently test new software, consider using virtual machines or containers to prevent your primary OS from accumulating residual configuration files and orphaned dependencies.


Uninstall Ubuntu WSL correctly from windows| Sabbirz | Blog

Uninstall Ubuntu WSL correctly from windows| Sabbirz | Blog

Read also: Privacy experts provide an explanation for Findpeoplesearch