How To Remove Packages From Ubuntu, Debian, Mint and Kali with Apt-Get Uninstall Command with Examples


apt-get is a standard package manager provided by popular distributions like Ubuntu, Debian, Mint, and Kali. We can use apt-get remove and purge in order to remove packages from the system. apt-get This package manager provides a lot of options in order to manage packages precisely. We have already examined very complete tutorial about apt-get command in the following link.

Apt and Apt-Get Tutorial With Examples

Uninstall Single Package

The simples usage form for apt-get remove command is providing a single package name. While providing package name we can provide only package name or other architecture and distributions related parts too. In this example, we will remove tmux package.

$ sudo apt-get remove tmux
Uninstall Single Package
Uninstall Single Package

Automatically Remove Package

As we can see in the previous example the apt-get command is asking a question about are we sure for this operation. Providing Y will accept but every time doing this can bore us. We can provide -y option if we want to accept and do not provide further Y to the console like below.

$ sudo apt-get remove -y tmux

Uninstall Multiple Packages

We can also uninstall multiple packages with a single command. We will separate the package names with space. In this example, we will remove packages named tmux and vim.

$ sudo apt-get remove tmux vim

Uninstall Multiple Packages with Globe

Some packages are provided with the same begging but the different end for their names. For example openoffice-writer , openoffice-calc etc. We can use  globe * operation to specify all packages those starts with openoffice- name like openoffice-*.

$ sudo apt-get remove openoffice-*
Uninstall Multiple Packages with Globe
Uninstall Multiple Packages with Globe

From the screenshot, we can see that the selected packages for removal. If there is a problem like not matching the package name the package name will be not listed. There is also the glob expression which simply means that the given package name and sub packages. For example, openoffice-* means all package names starting with openoffice-will be selected like openoffice-unbundled etc.

LEARN MORE  How To Clean Unused Packages with Apt Autoremove?

Uninstall Packages and Remove Configurations Too with purge

Uninstalling packages with removewill only uninstall package but do not remove related configuration and cache files. We can use purge in order to remove all related configuration and cache files like below.

$ sudo apt-get remove --purge tmux
Uninstall Packages and Remove Configurations Too
Uninstall Packages and Remove Configurations Too

Uninstall Unused Packages and Cache Files

After some time the old and cache files will take some space in our disk. These files are completely unnecessary files and can be removed without a problem. The autoremove command can be used to remove all these files and cache.

$ sudo apt-get autoremove

2 thoughts on “How To Remove Packages From Ubuntu, Debian, Mint and Kali with Apt-Get Uninstall Command with Examples”

Leave a Comment