Ubuntu uninstall package and dependencies. Learn how to uninstall apt package in Ubuntu and remove all installed packages Ubuntu terminal.
How To Uninstall Package In Ubuntu Using DPKG
The dpkg is a tool to install, build, remove and manage Debian packages.
Before you uninstall packages, you will have to get a list of installed packages. You can get the list using dpkg –list command.
The command dpkg –list shows the list of installed packages. Form which you can select the names of installed programs to remove/uninstall later.
This command is only used when you are not sure about the name of the program to remove or uninstall.
Another way is to use dpkg-remove command. The dpkg-remove marks package(s) to be removed. It achieves this by running dpkg --set-selections' and piping in the package name(s) followed by
deinstall’.
NOTE: This program does not install, remove, purge any package. It ONLY sets the status of the package. any actual removal or purging is done the next time dselect, apt-get,aptitude, etc are run.
Removing Packages Using dpkg
To remove a package using dpkg run the following command:
sudo dpkg --remove PACKAGE-NAME
NOTE: Type the actual package name (replace PACKAGE-NAME).
You can also use the same command using the -r parameter instead of remove. SO the command becomes:
sudo dpkg -r PACKAGE-NAME
In case you want to remove broken packages or packages which weren’t fully installed, run the following command:
sudo apt-get clean && sudo apt-get autoremove
sudo apt-get -f install
dpkg --configure -a
Note that the command parameter -f / –fix-broken install will fix broken dependencies and correct possible package corruption problems.