How to Remove Packages in Ubuntu

Photo of author

By Oluwaseun Bamisile

Published

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.

If you already know the actual name of the package you wish to remove, skip this sub-section and move to the next sub-section.

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).

The list of installed packages is arranged in alphabetical order.
How To Remove Packages In Ubuntu Through Terminal

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.

  1. 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
  1. Following that, you will be prompted to input your password. Do that and press the enter key on your keyboard.
 Note that the password does not show as you type it. 
How To Remove Packages In Ubuntu Through Terminal
  1. 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.
  1. Finally, Ubuntu will start to remove the package.
How To Remove Packages In Ubuntu Through Terminal

Frequently Asked Questions

1. When was Ubuntu released?

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.

2. What is the command to list all installed packages in Linux?

The command line to list all installed packages in Linux is “dpkg –list” (without the quotes).

3. How do I remove a package in the Linux terminal?

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.

4. What is the latest version of Ubuntu?

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.

5. What is Apt-get Clean?

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.

About the Author

Photo of author

Oluwaseun Bamisile

Oluwaseun is the Lead Content Editor at Itechguides.com. He holds a National Diploma in Computer Science (currently studying part-time for his Higher National Diploma). An internet geek with a love for automobiles, he writes product reviews, tech articles, and how-to guides on the site.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment

Send this to a friend