How to uninstall package: in Linux

How to uninstall package: in Linux

Sometimes you install programs or files and later want to delete them. If you try to use commands like "rm", you may end up with an error. Here we will explain to you how to properly uninstall the packages you installed.


It is always recommended to use the commands related to packages to manage them and avoid commands such as rm, which have a less clever and more direct purpose.

The package management process can be specific depending on your Linux distribution. For example, on Debian-based distributions such as Ubuntu, you will use the apt-get or apt commands to install, upgrade, downgrade, remove, or any other package management operation. On other distributions such as ArchLinux, you will use the pacman command.


To uninstall packages on a Linux Distribution (assuming you're under a Debian-based distribution):

  • If you want to uninstall a package, type:

apt remove your_package_name
apt-get remove your_package_name

  • If you also want to remove all the packages configuration files, type (it can be done instead of remove or after the remove operation): 

apt purge your_package_name 
apt-get purge your_package_name

Do not try to use commands like rm your_package_name as you may end up with an error, or if you succeed in removing the package that way, you may end up with an unstable system. The rm command aims to delete folders and files without carrying too much if the element to remove is also managed by another subsystem (in the case of packages, it will throw an error).

any more questions about linux? check out our forum!