Do you wish to remove a particular package from Ubuntu but don’t know how? This guide teaches how to remove packages in Ubuntu through the terminal.
Remove Packages Through the Terminal
Ubuntu provides multiple methods for installing packages. You can install a package from the Ubuntu Software Center in the GUI.
You can also install a package on Ubuntu by running a couple of command lines in the terminal. However, what if someone needs to uninstall a package?
Well, in the same way, you can install packages using the Ubuntu Software Center, you can also uninstall a package. However, if you are comfortable running command lines in the terminal, this section teaches how to uninstall packages in Ubuntu through the terminal.
As I mentioned in the introduction of this guide, you may need to list all packages first so you can get the name of the package you wish to uninstall. Use the steps in the first sub-section below to list all installed packages in your Ubuntu computer.
Step 1: Check Installed Packages Through the Terminal
As I said above, before you remove a package in Ubuntu via the terminal, you first ought to know the exact name of the package. You can do that by executing the dpkg command in the Ubuntu terminal to check the list of installed packages.
To use the dpkg command to check the list of installed packages in Ubuntu, type the command below and press the enter key.
dpkg --list
After executing the aforementioned command, press the end key on your keyboard to instantly get to the end of the list. To confirm if you’ve gotten to the end of the list, you will see (End).
After doing all that, take note of the actual name of the package you wish to remove from Ubuntu. Then, press “q” on your keyboard to end the process before moving on to the next sub-section.
If you don’t press “q” to end the process, you won’t be able to execute any other command.
Step 2: Remove Packages Using the Apt-get Command
After noting the name of the package you wish to remove from Ubuntu, you can then use the apt-get command to remove the package. To do that, follow the procedures and screenshot images below.
- Input the subsequent command below and press the enter key. However, replace “package name” with the exact name of the package you wish to remove from Ubuntu.
sudo apt-get --purge remove package name
For instance, if I want to remove the zerofree package from Ubuntu, below is what the command should look like.
sudo apt-get --purge remove zerofree
- Following that, you will be prompted to input your password. Do that and press the enter key on your keyboard.
- Consequently, the removal process of the package should begin, and a summary of the action will display. Hence, you will be asked if you want to continue – press “y” on your keyboard, then click the enter key to continue.
- Finally, Ubuntu will start to remove the package.
Frequently Asked Questions
The first version of Ubuntu – Ubuntu Version 4.10, codenamed “‘Warty Warthog” – was released on October 20, 2004. The company behind the development of this Linux-based operating system is Canonical.
The command line to list all installed packages in Linux is “dpkg –list” (without the quotes).
a) Use the “dpkg –list” command to display the list of installed packages in Linux – click the end key to get to the end of the list instantly.
b) After doing that, take note of the actual name of the package you wish to remove.
c) Then, press the “q” key on your keyboard to end the “dpkg –list” process.
d) Following that, execute the “sudo apt-get –purge remove package name” command line. However, replace “package name” in the command with the actual name of the package you wish to remove.
e) Consequently, you will be prompted to input your password – do that and press the enter key to proceed. Note that the password will not be visible when typing it.
f) After that, you will be asked if you want to continue – press “y” on your keyboard, then click the enter key to continue.
g) By doing that, Linux will begin to remove the package.
As of the time I wrote this guide in October 2022, the latest version of Ubuntu is Ubuntu 22.10. The code name for this version of the Linux-based Ubuntu operating system is Kinetic Kudu.
After installing packages using the apt-get install command in the Linux terminal, the apt-get clean command aids in clearing the cache on your system.
Conclusion
Removing packages in Ubuntu isn’t particularly easy. However, with the help of this guide, performing this task should be less bothersome.
To give more details, this guide taught us how to remove packages in Ubuntu through the terminal. Hence, we learned how to check installed packages in Ubuntu using the dpkg command.
Then, this guide demonstrated how to remove packages in Ubuntu using the apt-get command in the terminal.
I hope you were able to remove packages in your Ubuntu system using the procedures in this guide. If you were, click on “Yes” beside the “Was this page helpful” question below.
You may also express your thoughts and opinions by using the “Leave a Comment” form at the bottom of this page.
Finally, for more Linux guides, visit our Linux how-to page.