Ubuntu

How to uninstall package on Ubuntu


Are you a new Ubuntu user and facing storage problems and want to delete unnecessary packages then you are in the right place. Ubuntu allows you to install and uninstall the package by both graphical user interface and command line interface.

A “package” is a compressed file archive that contains all of the files that come with a given application in Linux distributions. New software for Linux-based PCs is delivered and maintained by a package. Executable installers are used in the same way as executable installers are used on Windows-based machines.

In this article two ways to uninstall a package from the Ubuntu system are discussed. You can follow any of the two according to your requirements.

Uninstalling Package Using Software Center of Ubuntu

Software center is like the App store of Apple and allows you to install and uninstall packages. If you are a new user and find the command line difficult then you can uninstall the package through the software center if it’s installed by Ubuntu software center.

Step 1: Open Ubuntu Software Center
Click on icon of Software Center from the list of icons on left side of Ubuntu screen:

Step 2:  Open installed apps
Click on installed tab on Ubuntu software center:

Step 3: Remove Package/App
Now you can remove any package which is present in installed packages of Ubuntu software center. I am removing Document Scanner from installed packages by clicking on the “Remove” button in front of package to be removed:

A dialogue box will appear, click on Remove:

Uninstalling Package on Ubuntu Using Command Line

Some installed packages are not available in “installed packages” of Ubuntu software center so we can remove them using the terminal. There are three ways to remove package using command Line:

  • apt
  • dpkg
  • snap

Uninstalling Package using “apt” : The best way is to use the “apt” command to remove packages.

The apt( Advance Packaging Tool) is the default package manager of Ubuntu.

$ apt remove <package-name>

Set the package-name which you want to remove.

Example: Run the below mentioned command to remove “nodejs” package from Ubuntu system:

$ sudo apt remove nodejs

In place of “nodejs” write the name of the package you want to remove.

Uninstalling Package Using “dpkg”: We can also remove package from system using dpkg command, dpkg is a Debian package manager that allows you to install, build, uninstall, and manage packages:

$ sudo dpkg –r <package-name>

Change “package-name” according to your requirement.

Example: Run the below mentioned command to remove “make” package from Ubuntu system:

$ sudo dpkg -r make

In place of “make” write the name of the package you want to remove.

Uninstalling Package using “snap”: Although the Snap package manager is very new, it is included in all current Ubuntu editions. To uninstall packages, which were installed as snap packages you need to run the snap command which works independent of apt command. The syntax is given below:

$ sudo snap remove <package-name>

Set “package-name” which you want to remove.

Example: Run the below mentioned command to remove “rocketchat-server” package (which is installed as snap package) from Ubuntu system:

$ sudo snap remove rocketchat-server

In place of “rocketchat-server” write the name of the package you want to remove.

Uninstalling unnecessary Packages : Your package management may download dependencies that are required to correctly install a package while installing some software. These dependencies will remain on your system after it finishes installing a package, but they will be unused. As a result, it’s a good idea to run the following command on a regular basis to clear out any unwanted packages from your system.

Run the below mentioned command to remove unused packages:

$ sudo apt autoremove

Conclusion

To free up the space occupied by some unused packages, Ubuntu allows you to remove these unnecessary packages from your system. In this article we discussed in detail how to uninstall unwanted packages using the Ubuntu software center and using the command line in which commands are discussed to remove packages from the system; using apt, dpkg and snap. Read the article carefully to uninstall unnecessary packages from your Ubuntu system.

About the author

Alishba Iftikhar

I am currently an undergraduate student in my 1st year. I am an internee author with Linuxhint and loved learning the art of technical content writing from senior authors. I am looking forward to opting my career as a full time Linux writer after I graduate.