How to uninstall software in Ubuntu from command line. In this guide you are going to remove software packages on your Ubuntu server or system from command line.
Using command line provide you more options and control over the software packages for removing. In this guide you are going to learn how to remove unused softwares.
- Root access to the server or a user with sudo privileges. Only root user or a sudo privileged user can only uninstall packages.
List Ubuntu Package Names
You can list out all the installed packages using the following command.
sudo apt list --installed
This command will print out a long list of installed packages. You can limit the results using the
sudo apt list --installed | less
You can also search for specific packages using the
sudo apt list --installed | grep package_name
You can remove packages using the following command.
sudo apt remove package_name
You can also remove multiple packages using a single command.
sudo apt remove package_name_1 package_name_2
remove command uninstalls the given package and might leave some files or directories behind. So, if you want to remove the packages and all the files related to the package you can use the
purge command instead of the
sudo apt purge package_name
Uninstall Snap Packages
If the package you wish to remove is not listed in the list command, it might be installed as a snap package.
You can list out the packages that are listed as snap using the following command.
You can remove the snap packages using the following command.
sudo snap remove package_name
Remove Unused Packages
When you install a package it also installs other dependency packages that are related to the package.
So, once you remove a package the dependency package will not be uninstalled and will remain in the system.
To remove these kind of unused packages you can use the
sudo apt autoremove
Become a Linux System Administrator and maintain virtual servers in a multi-user environment.
Now you have learned how to uninstall software packages and remove all unused packages in your Ubuntu.
Thanks for your time. If you face any problem or any feedback, please leave a comment below.