Strictly speaking, Linux is the kernel. Linux distribution is made of Linux kernel, installation scripts, shell, compilers, desktop, and other components. Hence, Linux command to uninstall package or software depends upon Linux distribution name and type. This page explains how to uninstall package or software on various Linux distros using the command line.
Linux uninstall package / software
- First, you need to find a list of all installed packages on Linux.
- To uninstall an application, you need to use Linux distro-specific command. For example, use the apt command on Debian or Ubuntu Linux. RHEL/CentOS/Fedora Linux users need to run either the dnf or yum command and so on.
- Finally, we can use various commands for verification of the uninstallation of a program on Linux.
Let us see all commands in action to uninstall a program on Linux.
Ubuntu/Debian Linux uninstall software
The syntax is as follows to list all installed packages on Debian or Ubuntu Linux using the apt command:
apt list --installed
How to find out exact package names in Debian/Ubuntu/Mint Linux
dpkg --list
dpkg --list | grep '^ii'
Use the ‘dpkg --list‘ command to get a list of all installed packages on an Ubuntu or Debian/Mint Linux
dpkg --list | grep -i 'package'
apt list --installed \*package\*
apt list --installed \*ping\*
dpkg --list | grep -i 'firefox'
dpkg --list | grep -i 'ping'
grep command in action to filter out package names quickly that you want to uninstall
sudo apt remove 2ping
sudo apt remove --purge 2ping
OR
sudo apt-get remove 2ping
sudo apt-get --purge remove 2ping
First, you need to enter your password when prompted and press the [Enter] key. The --purge is optional. We use it when we need to uninstall the package and all of its configuration files. When prompted, “Do you want to continue?”, type a y and press the [Enter] key:
Do not pass the --purge option if you don’t want to delete the config file for the package. For example, to remove the nginx package and leave all config files as it is on disk, run:
sudo apt remove nginx
#### OR #####
sudo apt-get remove nginx
Finally verify that nginx has been removed or uninstalled from the system, run:
dpkg --list | grep nginx
apt list --installed | grep nginx
Now you know how to uninstall package on a Debian or Ubuntu or Mint Linux. Let us see other distros.
RHEL/CentOS/Oracle Linux
We need to use the yum command for CentOS/RHEL v6.x/7.x. First get a list, run:
sudo yum list installed
sudo yum list installed | grep package
sudo yum list installed | grep zip
yum command in action
sudo yum remove zip
Use the dnf command on a CentOS/RHEL/Oracle Linux 8 as follows to uninstall software:
sudo dnf list installed
sudo dnf list installed | grep zip
sudo dnf remove zip
Fedora Linux
Again, we need to the dnf command as follows:
## List all installed packages ##
sudo dnf list installed
## Filter out the package named httpd ##
sudo dnf list installed | grep httpd
## Delete the httpd ##
sudo dnf remove httpd
Arch Linux
We use the pacman command on Arch Linux to uninstall software. Pass the Q to list all installed packages on Arch Linux:
sudo pacman Q
sudo pacman Q | more
sudo pacman Q | grep sl
To delete/remove the sl package in Arch, run:
sudo pacman -R sl
pacman command in action to list and uninstall package on an Arch Linux
OpenSUSE or SUSE Linux removing package command
We are going to use the zypper command. To list all installed packages in SUSE/OpenSUSE, run:
sudo zypper packages --installed-only
sudo zypper packages --installed-only | grep -i package
sudo zypper packages --installed-only | grep -i zip
I am going to remove the zip package, enter:
sudo zypper remove package
sudo zypper remove zip
Alpine Linux
Use the apk command to list installed packages only:
sudo apk list
sudo apk list -I
sudo apk list -I 'package'
sudo apk list -I 'zip'
To uninstall the zip Linux uninstall software pass the del as follows:
sudo apk del pkg
sudo apk del zip
apk command in action
Conclusion
You learned how to uninstall package on popular Linux distros. I would strongly recommend reading the man pages:
man yum
man dnf
man apt
man zypper
man pacman
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |