How to uninstall Software completely in Linux Mint 17 / Ubuntu 14.04 / Debian 7.6

What is dpkg ?

dpkg stands for Debian Package Manger. dpkg is a package manager for Debian-based systems such as Debian, Ubuntu & Linux Mint, etc,.. It can automatically download and install, remove, build packages and their dependencies when we enter the package name in terminal.

What is apt-get ?

apt-get stands for Advanced Packaging Tool (APT). apg-get is a powerful command-line tool which is used to automatically download and install new software packages, upgrade existing software packages, update the package list index, and to upgrade the entire Ubuntu system.

What is make ?

make is a powerful command-line tool which is used to install/un-install software/package from source code directly. All the software/package source code archives contain makefile. makefile reads their own software files and makes them to executable program. If Package is not available in the repositories we need to use this method to install software. To make use of it on ubuntu you need to install build-essential package.

Syntax :

Common syntax for apt-get & dpkg for removing packages.

apt-get remove <package_name> : Removing package using apt-get
dpkg -r <package_name> : Removing package using dpkg

1) Checking package details

For testing purpose i’m going to list the nginx package and show you how to remove completely from Ubuntu related distributions. The output here clearly shows three packages about nginx.

[email protected]:~# dpkg -l | grep nginx
ii  nginx                            1.6.2-2+trusty0             all          small, powerful, scalable web/proxy server
ii  nginx-common                     1.6.2-2+trusty0             all          small, powerful, scalable web/proxy server - common files
ii  nginx-full                       1.6.2-2+trusty0             amd64        nginx web/proxy server (standard version)

2) Remove package using apt-get & dpkg

Try to use the below commands and see the output. This will work when you install software/package from ubuntu source. If you install the software/package from other repositories such as ppa.launchpad.net it will not be removed completely.

# Removing package using apt-get #
[email protected]:~# apt-get remove nginx
[email protected]:~# apt-get --purge remove nginx
[email protected]:~# apt-get purge nginx

# Removing package using dpkg #
[email protected]:~# dpkg -r nginx

# After removing package you need to update your system #
[email protected]:~# apt-get update

output : If you use above commands to remove packages (except ubuntu repositories) you will get below output after uninstalling nginx. It seem’s the above commands removed only main package not their supporting packages.

[email protected]:~# dpkg -l | grep nginx
ii  nginx-common                     1.6.2-2+trusty0             all          small, powerful, scalable web/proxy server - common files
ii  nginx-full                       1.6.2-2+trusty0             amd64        nginx web/proxy server (standard version)

After remvoing main package (If you run above commands – except ubuntu repositories) you need to run the below command once again to remove the supporting packages but unfortunately it will not be removed completely because the below output is still showing nginx package.

[email protected]:~# apt-get autoremove

# Checking output #
[email protected]:~# dpkg -l | grep nginx
ii  nginx-common                     1.6.2-2+trusty0             all          small, powerful, scalable web/proxy server - common files

3) How to Remove package completely using apt-get

To completely remove package use apt-get command according to your package output which you got from dpkg command. In my scenario, see nginx output in Point 1). Three varieties of nginx package are installed. So based on my output I’m going to use apt-get command like below to remove complete nginx package from my ubuntu box.

[email protected]:~# apt-get purge nginx-*

# Checking output #
[email protected]:~# dpkg -l | grep nginx

4) How to remove manually installed package using make

If you installed package using make file you can uninstall the package using the same way which you used to install the package. Navigate to your package directory and follow the below steps to remove it. I have installed node package using make file for testing purpose and i reinstall it. see the below output.

cd ../
[email protected]:/opt/node-v0.10.32# ./configure
[email protected]:/opt/node-v0.10.32# make
[email protected]:/opt/node-v0.10.32# make uninstall

# Output shows error because package is uninstalled #
[email protected]:/opt/node-v0.10.32$ node -v
bash: /usr/local/bin/node: No such file or directory

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...