How to Debloat (or Swap) an Ubuntu System (Ultimate Guide)

Linux TLDR
Last Updated:
Reading time: 5 minutes

Ubuntu is a popular Linux distribution that has consistently ranked among the top for over a year. I assure you that most of you reading this article undoubtedly had Ubuntu as your first Linux distribution.

Two decades ago, when it was released, it was the only system that had good stability, support, and user-friendliness, but like any other operating system, it got bloated with unwanted stuff over time.

If you’re a tech guy, you might have noticed that popular operating systems such as MacOS, Windows, Android, and iPhone become slower with every new update, which might impress some users as it sometimes brings new features to the table but might also annoy other users.

With Ubuntu, things are a little different; there are multiple reasons that keep it in controversy, whether it’s the choice to use systemd as the init system or shipping snapd daemon by default. What personally annoys me the most is the choice to ship Firefox as a snap package.

In this situation, most of you think of switching to a different Linux distribution, such as Debian, Linux Mint, Fedora, Arch, etc., but if you’re unable to make the switch, then read this article to discover how you can debloat (or swap) Ubuntu into a Linux system that everyone loves.

How to Debloat (or Swap) an Ubuntu System

There are multiple things that annoy users while using Ubuntu, some of which are listed below. You can check each section to immediately take action with the provided solution. So, let’s begin with…

Remove Snaps and Snapd

Snaps is a sandbox technology developed by Canonical, the same organization that developed Ubuntu. It’s quite controversial; many like it for making programs available for multiple distributions, but there are people like me who prefer its alternative, Flatpak.

So, if you’re using Ubuntu, Snap is already installed on your system. To remove it, you first need to note the applications installed as Snap. If it’s a fresh Ubuntu installation, mostly Firefox is the only application, but you can check the list of all Snap packages using the “snap list” command.

I assume you haven’t installed any separate Snap package other than the one that came preinstalled with your distribution, so to remove the Firefox Snap, Snap Store, and other packages, execute the following commands:

$ sudo snap remove --purge firefox
$ sudo snap remove --purge snap-store
$ sudo snap remove --purge gnome-3-38-2004
$ sudo snap remove --purge gtk-common-themes
$ sudo snap remove --purge snapd-desktop-integration
$ sudo snap remove --purge bare
$ sudo snap remove --purge core20
$ sudo snap remove --purge snapd

Once the above Snap packages are removed, you may proceed to remove the Snap daemon using the APT command.

$ sudo apt remove --autoremove snapd
$ rm -rf ~/snap

Once you’ve removed Snap using the above command, the “sudo apt update” command will bring back Snap again if you don’t stop the apt trigger. To do so, you’ll need to create an apt preference file in “/etc/apt/preferences.d/” and name it “nosnap.pref” to prevent Snap from reinstalling.

$ sudo printf "Package: snapd\nPin: release a=*\nPin-Priority: -10" | sudo tee /etc/apt/preferences.d/nosnap.pref

Once you save and close the above file, execute the following command:

$ sudo apt update

That’s it; you have completely gotten rid of Snap from Ubuntu.

Install Firefox as a DEB from the Mozilla Repo

When you removed the Snap, it also removed the Firefox Snap package, which comes preinstalled on most Ubuntu systems today. Therefore, to install Firefox as a DEB package, you can use the Mozilla PPA, but ensure beforehand to install the apt version of Gnome Software.

$ sudo apt install --install-suggests gnome-software

Now, add the official Mozilla PPA and install Firefox from it using the command below.

$ sudo add-apt-repository ppa:mozillateam/ppa
$ sudo apt update
$ sudo apt install -t 'o=LP-PPA-mozillateam' firefox

Once Firefox is installed using the above command, ensure to enable automatic updates for it using the following command:

$ echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

Finally, create another preference file for Firefox to assign super high priority to the Mozilla PPA when executing apt, thereby preventing the “apt update” command from retrieving the Firefox Snap.

$ sudo printf "Package: firefox*\nPin: release o=LP-PPA-mozillateam\nPin-Priority: 501" | sudo tee /etc/apt/preferences.d/mozillafirefoxppa

That’s it.

Add Support for Flatpaks

Flatpak is another sandbox technology (like Snap), but it’s bloat-free, and there’s nothing forcing you to use a proprietary app store to distribute or install packages, unlike Snap Store.

In Ubuntu, Flatpak is not preinstalled, but other popular Linux distributions like Fedora come with Flatpak preinstalled, yet you can easily install it on your Ubuntu system using the following command:

$ sudo apt install flatpak

Once Flatpak is installed, if you are using GNOME DE, you can enhance your experience by installing the GNOME Software plugin for Flatpak using the following command:

$ sudo apt install gnome-software-plugin-flatpak 

Lastly, include the Flatpak repository for searching for and installing new Flatpak applications.

$ flatpak remote-add --if-not-exists flathub

You’ve successfully installed and configured Flatpak on your system. Now, you can use the CLI to manage your Flatpak packages, but I would recommend trying Warehouse Toolbox (a GUI application) to manage them.

Removes Games and LibreOffice

The full version of Ubuntu includes some CLI games and LibreOffice; if you don’t need them, you can use the following command to remove them and free up a good amount of disk space.

$ sudo apt remove aisleriot gnome-mahjongg gnome-mines gnome-sudoku *libreoffice* -y

The above command will remove limited packages from your Ubuntu system without breaking, but if you want to remove other unnecessary packages, check out this Ubuntu bloat removal script.

Install the KDE Desktop Environment

GNOME is a popular DE choice for Ubuntu, and most users think Ubuntu only comes with GNOME, but that’s not the case; there are other variants of Ubuntu such as Kubuntu (which comes with KDE) and Xubuntu (which comes with Xfce).

If you downloaded and installed Ubuntu from the official ISO image, you might be running Ubuntu with GNOME DE, which is quite bloated with unnecessary packages compared to other DEs.

So, my first priority would be suggesting you try different DEs, such as KDE; it’s simple, lightweight, highly customizable, and can be easily installed on Ubuntu using any of the following commands:

# Install the complete KDE Plasma Desktop (the package size is around 1 GB).
$ sudo apt install kde-full

# Install the standard KDE Plasma Desktop with a standard set of KDE apps. (the package size is around 273 MB).
$ sudo apt install kde-standard

# Install the minimal KDE Plasma Desktop with a minimal set of KDE apps, best suited when you simply want to give it a try (the package size is around 175 MB).
$ sudo apt install kde-plasma-desktop

If you choose to install the complete KDE Plasma Desktop, you will be prompted to configure “SDDM“, the Display Manager used by the KDE Desktop. Select “sddm” from the list and press “Enter“.

configuring sddm in kde installation

Once you’ve done it, it will configure the remaining packages. Then, you can reboot, choose KDE from the login screen (if required), and log in with your default credentials.

kde login screen

That’s it. Now you can experience the KDE environment on your Ubuntu system, but note that GNOME DE is still installed and consuming additional disk space.

So, if you enjoyed using KDE, then you can remove GNOME; otherwise, switch to GNOME and remove KDE if you disliked it using the following command:

$ sudo apt --purge remove kde-full
$ sudo apt --purge remove kde-standard
$ sudo apt --purge remove kde-plasma-desktop

# After executing one of the above commands, make sure to remove all unused dependencies by running the following command:
$ sudo apt autoremove

That’s it.

Final Word

I hope you find this article useful. Although I tried to cover things that annoy me while using Ubuntu, if there is something that must be mentioned but is missing from this article, then do let me know in the comment section.

You can also check out the Ubuntu debloater script to quickly perform the first four steps mentioned in this article all at once. Here, I’ll conclude this article; if you have any questions or queries related to the topic, please feel free to let me know.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.

6 thoughts on “How to Debloat (or Swap) an Ubuntu System (Ultimate Guide)”

      • I am not a snap hater. I don’t know why you have launched the “ad hominem” attack against me. Why don’t you provide some argument, why you prefer snap instead. And I don’t understand why using such a strong words like “hate” is even needed. I just like or dislike the things, what I dislike I uninstall and what I like I install. No need to lose energy to hate.

        I used to use snap before, but I just need some of the apps that are not available as snaps, but I have found out all of the apps I need are available as flatpak. I see no reason to use two technologies snap and flatpak, so I removed snap and installed flatpak.

        I also use Fedora Silverblue and so having the same system on both of the distributions is nice simplification.

  1. First try another flavor of Ubuntu. I use the Mate edition that has removed the more intrusive and spying type applications. The other thing you can try is some flavors that offer minimal installs. I like to use them, then I install software I need as I need it, rather than spending a lot of time removing software I will never use.