Manually Remove a Package in Ubuntu
Let’s take a look at how we normally remove a package from our Ubuntu installation. We open up Synaptic Package Manager, search for the program/package name, right click on it and select “Mark for removal.” There is also the option for “Mark for complete removal”, which leads to confusion for many users. In this article we will look at each, their differences and how to do the same from the command line.
Removing Packages from Ubuntu Using Synaptic Package Manager
Marking packages for removal in Synaptic Package Manager basically removes the package and the dependencies installed with the package. At this point Synaptic also checks if the dependencies are also used by any other application and if used, it does not remove them. With the “Mark packages for removal” option, Synaptic also leaves the configuration files behind, it does not delete them. To remove the configuration files from the system, the option “Mark for complete removal” has to be selected.
Removing Packages from Ubuntu Using the Command Line
There are some tasks which I find to be performed easier from the command line, and one of them is installing/removing packages. We can use the apt commands for easily removing packages from our Ubuntu installation:
- To remove packages: sudo apt-get remove package_name
- To remove packages and dependencies: sudo apt-get autoremove package_name
- To remove packages, dependencies and configuration files: sudo apt-get purge package_name
If you remove a package using the apt-get remove command, you can clean up the dependencies any time by running the sudo apt-get autoclean command.
Removing Packages from Ubuntu Installed from Source
If you have installed any packages from source (or “tarball”, the packages with the tar.gz extension, which you have installed with configure, make, make install) routine, then you have to uninstall them in a different way. To uninstall those programs, I strongly suggest you to take a look at the README file that is inside the tarball you have downloaded, which -in most cases- contains information about how to remove the application. The instructions may be:
- Running an uninstall script, such as uninstall.sh,
- Running uninstall commands, such as make uninstall,
- In some cases deleting a directory, such as /home/username/downloads/this_app
Since all these alternative depend on how the programmer has created the uninstall routine, it is not possible to give precise guidance as in the previous sections. Again, you will find the information in the README file.
The package management in Ubuntu is very easy thanks to the powerful Debian tool apt (Advanced Package Tool). Whether you are using the graphical tool Synaptic or the command line tool apt, the packages on your system, together with their dependencies will always be very-well maintained.