- Remove Package in Ubuntu: Linux How to Uninstall
- Apt Uninstall
- Find Installed Software
- Using the Apt-Get Purge Command for Ubuntu Uninstalls
- Using the Apt-Get Remove Command for Ubuntu Uninstalls
- Autoremove
- Using the -f Option
- Uninstall Using a PPA
- Synaptic Uninstall
- DPKG Uninstall
- Source Uninstall
- Git Uninstall
- Snap Uninstall
- Ubuntu Software Manager Uninstall
- Flatpak Uninstall
- AppImage Uninstall
- Conclusion
- Related Articles:
- About the Author: Alison Gray
- How can you completely remove a package?
- 10 Answers 10
Remove Package in Ubuntu: Linux How to Uninstall
This tutorial demonstrates how to quickly and easily uninstall software on Ubuntu. Uninstalling software can be done using several techniques. It shows 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, you 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.
Apt Uninstall
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, you can find out the 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.
This command removes the aptitude cache located in /var/cache/apt/archives. When you install a program, the package file is downloaded and stored in that directory. You do not need to keep the data in that directory. However, the only drawback of deleting that information is that if you decide to re-install any of those programs again, the packages would have to be downloaded again.
Using the Apt-Get Purge Command for Ubuntu Uninstalls
The apt-get purge command removes a package and its configuration files. However, the dependencies for the package remain in the system, along with the configuration files in the home directory. Use the following command, substituting PACKAGE_NAME with the desired package for purging.
apt-get purge PACKAGE_NAME
Using the Apt-Get Remove Command for Ubuntu Uninstalls
The apt-get remove command is similar to the purge command, except the binaries and dependencies are all removed. Use the following command, again substituting PACKAGE_NAME with the desired package for removal.
apt-get remove PACKAGE_NAME
Autoremove
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:
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
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, 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.
Top
Synaptic Uninstall
Synaptic is the GUI package manager for Ubuntu and is not usually installed on the server version of Ubuntu. It is included here to provide a more complete overview of uninstall methods. To uninstall software using Synaptic:
- Open the application.
- Scroll through the list of installed applications and click on the software to highlight it.
- Right-click and select Mark for Removal
- 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.
Top
DPKG Uninstall
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, you can search for the command using the less command. If you do not know the full name, you 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*
The dpkg command is not the optimal method to install or remove a software package, as during the uninstallation process, dpkg may remove the specified package, but leave all of its associated dependencies on the system which may no longer function correctly.
Source Uninstall
To Uninstall software that was set up from source code in Ubuntu
- First, you should not delete any source code you used to install the program.
- Second, you 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.
As an aside, try to limit installing software on a system using the ./configure && make && make install commands as most makefiles do not have or support an uninstallation process and as such, they are limited in this aspect. Always attempt to use a package manager that supports the tracking of install locations (.deb snap, etc) and let the package manager take care of removing and cleaning up uninstalled files and directories.
Typically, you should be able to uninstall the program by going to its extracted directory and using this command:
You can also try to get a look at the steps used to install the software by running:
and then noting all the directories mentioned during the installation process and manually remove the entries.
Normally, you 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.
You 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 you try to install a package that contains the same file as the software you are compiling, you will receive errors, and the software you 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 you can use it for any installation task outside apt, and it will keep track of the installation in the package manager.
Top
Git Uninstall
Typically, Git simply clones an external repository to a local folder. If you 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 you can just recursively delete that folders hierarchy.
Top
Snap Uninstall
Snap provides an easy method to install or uninstall software. From the command line, you 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. You can then use the remove option to remove the software.
Top
Ubuntu Software Manager Uninstall
To uninstall software using the Ubuntu Software Manager, you should click on the icon in the Activities toolbar. This will open the Ubuntu Software Manager where you can search for, install and uninstall software from your computer. In the list of applications, you would look up the software you 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.
Top
Flatpak Uninstall
If an application was installed using Flatpak, you can begin by either searching for the application or listing all the applications installed via Flatpak. You 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
AppImage Uninstall
Since the AppImage software is not «installed» in the normal sense of the word, you do not need to «uninstall» it. You 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, you 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. You can usually accomplish this using the ctrl + h keyboard sequence.
Top
Conclusion
There are multiple methods of installing and uninstalling software on Ubuntu. These functions ensure your systems are kept clean and up to date.
If you need a new Ubuntu server for your next project, Liquid Web offers VPS Hosting, Cloud Dedicated Servers, and Dedicated Servers with the Ubuntu operating system. Contact our sales team for more information.
Related Articles:
About the Author: Alison Gray
Alison Gray is currently an IT Project Manager at Liquid Web and has been with Liquid Web for nearly 10 years. In 2015, She earned her Bachelor’s Degree in Media and Information from Michigan State University. In her free time, she loves spending time with her girlfriend and 3 kids. You can usually find her at a basketball court or some sort of sporting event. If the weather’s right, she loves being outside in the yard finding some sort of yard work to do.
Join our mailing list to receive news, tips, strategies, and inspiration you need to grow your business
How can you completely remove a package?
I am trying to do a clean install of the octave3.2 package. To do this, I removed it, then tried to reinstall it. When I reinstalled, an error occurred. It could be a bug in the package, but I want to make sure I have everything removed so that I can do a clean install. Is it enough to do this?
sudo apt-get --purge remove octave3.2
10 Answers 10
This is a very general answer to the question about the effects of purging packages. For advice specific to your situation, you’ll have to edit your question to include additional information—in particular, the complete and exact text of the error message you are getting.
Removing packages with sudo apt purge . or sudo apt —purge remove . will remove them and all their global (i.e., systemwide) configuration files. This is usually what people mean when they talk about completely removing a package.
But that doesn’t mean your system is the same as it was before the package was installed. In particular:
- This does not remove packages that were installed as dependencies, when you installed the package you’re now removing. Assuming those packages aren’t dependencies of any other packages, and that you haven’t marked them as manually installed, you can remove the dependencies with sudo apt autoremove or (if you want to delete their systemwide configuration files too) sudo apt —purge autoremove .
- This does not remove non-systemwide configuration files. Specifically, it does not remove user-specific configuration:
- It does not remove the configuration files and directories located in users’ home directories (or in the .config subdirectory of their home directories), created by the software the package provides.
- If these files/folders are not stored in .config , they usually start with a . themselves. Either way, you can see them with ls by using the -a or -A flag, and you can see them in Nautilus and most other file browsers/managers by pressing Ctrl + H or going to View >Show Hidden Files.
- It does not remove the configuration files and directories located in users’ home directories (or in the .config subdirectory of their home directories), created by the software the package provides.