What Does the Following Command Do in Ubuntu? “dpkg -r ubutestpackage”

Ubuntu provides a free and open-source platform for contributors. The “dpkg” is one of the package managers, available in the Ubuntu repository. With the help of the “dpkg”, you can install, remove, build, and manage Ubuntu packages such as Debian.

There are several flags that have different actions. For instance, -i is for installing the package, -r will remove the package, and -V is to verify, etc.

This post will explore and improve your concepts about the use of “dpkg -r” in Ubuntu 22.04. Briefly, the command will remove the installed package and its libraries except for the configuration files.

What Does the Following Command Do in Ubuntu? “dpkg -r ubutestpackage”

The following steps will be used to understand the purpose of “dpkg -r” in Ubuntu 22.04.

Step 1: Open CLI

Use any Ubuntu command, you need to open CLI or the terminal window. You can launch the terminal from the Ubuntu Applications or simply press Ctrl + Alt + T from the keyboard.

Step 2: List the Packages Available in Ubuntu

It is important to list the package with its correct name before removing the package(s). Here, we will use the “wine” package as an example in place of the “ubutestpackage”.

Run the command written below to ensure the correct name of the package:

dpkg --list wine

According to the above output result, the “wine” package is available with the correct spelling. Now, you can use the “dpkg -r” command to remove the package from your Ubuntu 22.04 machine.

Note: In the above command, specify your package name instead of the “ubutestpackage.”

Step 3: Remove the Package with “dpkg -r”

After confirmation of the package, you can remove the package using the following dpkg command:

sudo dpkg -r wine

It can be seen in the above output snapshot, the “wine” package has been removed without any error.

Step 4: Verify the Removed Package

To verify whether the package has been removed or not from your Ubuntu 22.04, check out the version of the uninstalled package:

wine --version

The output message displayed on your screen shows that the package is no longer available on your machine, which signifies that the dpkg command successfully removed the specified package.


The “dpkg” is a powerful package manager used in Ubuntu for different tasks including removing packages. In Ubuntu, the “dpkg -r ubutestpackage” is used to remove the package along with its required libraries and files. In this educational guide, we explored the main purpose of “dpkg -r” with some real-time examples.

Print Friendly, PDF & Email