In this tutorial, we will demonstrate how to quickly and easily uninstall software from Ubuntu. Uninstalling software can be done using several techniques. In this article, we will show you how to uninstall software using these various methods.
On Ubuntu, the main applications or methods used to install software packages are seen below.
Each of these methods have specific methods to uninstall software.
In preparation for uninstalling software from Ubuntu, we will need sudo permissions. By accessing the sudo permissions level, before running commands, you can avoid having to authenticate these root-level commands each time.
Different Operating Systems use various commands to execute actions. To interact with the packages on Ubuntu, you will typically want to use the apt command. You will see this command used numerous times in the instructions below. Let’s get started!
Find Installed Software
If you have an idea of what you want to uninstall, but you don’t know the exact name, see our article about finding out exact package names in Linux. You can also use the apt or dpkg command to see a list of all installed packages on your computer, press “Ctrl + Alt + T” to open a Terminal window. Type one the following command at the prompt and press “Enter”.
apt list --installed apt-cache search packagename or dpkg --list
Scroll through the list of installed packages in the Terminal window to find the one you want to uninstall. Note the full name of the package. Then, type in one of the following commands.
apt remove package_name apt remove package_name_1 package_name_2 apt purge package_name
These commands are useful for specific situations.
sudo apt-get clean
This command removes the aptitude cache located in /var/cache/apt/archives. When we install a program, the package file is downloaded and stored in that directory. The thing is, we do not need to keep the data in that directory. However, the only drawback of deleting that information is that if we decide to re-install any of those programs again, the packages would have to be downloaded again.
In case you want to remove any dependencies such as the applications and libraries used by the software you once installed that is no longer in use, you can do some housekeeping through the following command:
$ sudo apt-get autoremove
This command will list all the obsolete and unused packages and any leftover dependencies taking up valuable space on your system. The system will also prompt with a y/n option to reconfirm the uninstallation procedure. When you click Y, the process will begin, and the unwanted software dependencies will be removed from your system.
Using the -f Option
apt-get –f install
This option uses the -f flag to examine the installed applications and will attempt to repair or remove any packages it finds that are broken.
Uninstall Using a PPA
To uninstall Software installed via PPA, we can use the following two commands.
apt-get remove numix-gtk-theme numix-icon-theme-circle add-apt-repository --remove ppa:numix/ppa
The first command removes the software installed via the PPA. The second command removes the PPA from sources.list.
Synaptic is the GUI package manager for Ubuntu and is not usually installed on the server version of Ubuntu. We include it here to provide a more complete overview of uninstall methods. To uninstall software using synaptic, we would open Synaptic, scroll through the list of installed applications, click on the software to highlight it, then right-click and select Mark for Removal, and finally click Apply. This will uninstall the software, but leave the configuration files intact. To delete the associated configuration files along with the software, select Mark for Complete Removal instead.
To list software installed via dpkg, use one of these commands.
dpkg ––list dpkg–query –l | less
If you know the name of the software, we can search for the command using the less command. If we do not know the full name, we can also search for a partial name.
Before uninstalling a software package, it is a good practice to note the entire software name for accuracy. Run the following command and note the name of the software or application.
dpkg–query –l | grep package_name dpkg–query –l | grep *partial_name*
dpkg --remove packagename.
To Uninstall software that was set up from source code in Ubuntu
- First, we should not delete any source code we used to install the program.
- Second, we should ensure at installation, that there is a way to uninstall the program. A poorly configured program might not provide a way to uninstall the program, and then you’ll have to manually remove all the files installed by the software.
Typically, you should be able to uninstall the program by going to its extracted directory and using this command:
sudo make uninstall
You can also try to get a look at the steps used to install the software by running:
make -n install
and then noting all the directories mentioned during the installation process and manually remove the entries.
Normally, we can use the makefile to delete the executable file and all the object files from the directory by running the following command.
The make clean command usually cleans up the directories where the software was installed, however, it may not uninstall the package completely. Any dependencies needed or applied during the installation process may not be removed.
We can also use the checkInstall command instead of just running sudo make install, as that will likely put files all over the system with no easy way of removing them if things go wrong. In the future, if we try to install a package that contains the same file as the software we are compiling, we will receive errors and the software we originally compiled may stop working.
In fact, checkinstall can keep track of files modified by any source install and not just a make install, so we can use it for any installation task outside apt, and it will keep track of the installation in the package manager.
Typically, Git simply clones an external repository to a local folder. If we used some form of non-standard prefix when configured so that a package has been installed under a specific hierarchy, (e.g. like under /opt/git/software/), then we can just recursively delete that folders hierarchy.
Snap provides an easy method to install or uninstall software. From the command line, we can use the following commands to locate and then remove the software.
snap list snap remove software
The list option provides an overview of all the installed snap packages. We can then use the remove option to remove the software.
Ubuntu Software Manager Uninstall
To uninstall software using the Ubuntu Software Manager, we should click on the icon in the Activities toolbar. This will open the Ubuntu Software Manager where we can search for, install and uninstall software from our computer. In the list of applications, we would look up the software we want to uninstall, and then click the Remove button to uninstall it.
If you’re short on space, you can use the “clean” command to remove downloaded archive files, as shown below.
If an application was installed using Flatpak, we can begin by either searching for the application or listing all the applications installed via Flatpak. We can then use the uninstallation option with flatpak by using the flatpak command along with the application id to remove the installed Flatpak software.
flatpak search flatpak list flatpak uninstall
Since the AppImage software is not “installed” in the normal sense of the word, we do not need to “uninstall” it. We simply have to delete the AppImage file and the application will be removed (but, this will not remove the data the application has created and/or downloaded). Also, we should remove menu entries by removing the desktop file from $HOME/.local/share/applications/.
Files and directories with names starting with a dot, like
.example which are concealed, may need to be unhidden. You can probably find it in the settings of the file manager you use or in many file managers. We can usually accomplish this using the ctrl+h keyboard sequence.
There are multiple methods of installing software on Ubuntu. Luckily, we have many ways of removing that same software to ensure our systems are kept clean and up to date.
Are you having trouble removing software from your server? Give us a call today at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable Linux admins or systems administrators! We can help!