How to Uninstall Software in Linux With Apt

Installing a package with Apt is easy. But most users are unaware of the fact that even after the installation, the downloaded packages take up storage space. To free up that disk space, you’ll have to uninstall the package and remove it from the system completely.

Luckily, Apt comes with some built-in options that provide all the functionalities you need in order to delete a package from your system.

Let’s look at the correct way to get rid of an application in Linux using Apt.

How to Remove a Package With Apt

Apt offers various commands that you can use to remove packages from your Linux computer.

Uninstall a Package With Apt-Get Remove

Apt-get remove uninstalls the package from your system but keeps the configurations and other user settings associated with the package. When you reinstall the package, your old configurations and settings will load automatically.

For example, if you installed a game using apt, apt-get remove will uninstall the game but will keep your high scores and save files intact.

But before removing a package from your system, you need to know the exact name of the package, otherwise, apt-get remove will throw an error.

To get a list of all the packages on your system, type:

dpkg --list

Search for the package you want to delete and note down its complete name. For example, let’s say randompackage is the name of the package that you want to uninstall.

Open up your terminal by pressing Ctrl + Alt + T and type:

sudo apt-get remove randompackage

If there are multiple packages that you want to get rid of, just type in all the package names separated with the Space character as follows:

sudo apt-get remove package1 package2 package3

Keep in mind that only a root user will be able to remove packages from a Linux system. Type in the root password and press Enter. You will also get a prompt asking you to confirm your choice again. Type in Y and hit Enter to continue. Apt will now start uninstalling the specified packages.

Related: What Does “Bash” Mean in Linux

Remove a Package With Apt-Get Purge

Unlike apt-get remove, apt-get purge completely removes the package from your system, along with the personalized settings and configurations.

Launch your terminal and type in the following command to remove the package completely:

sudo apt-get purge randompackage

You will be asked for the root password; type it in and press Enter. Confirm your choice again by entering Y whenever the prompt comes up.

An alternative way to purge packages using Apt is by using the –purge flag in the default apt-get remove command:

sudo apt-get --purge remove randompackage

Cleaning Up With Autoremove and Clean

When you use apt-get install to install a package on your Linux machine, Apt downloads the package from official repositories. The installation process takes place and the downloaded file is kept in the local storage.

If you do not use the apt-get purge command frequently, unnecessary orphaned packages might fill up your system storage. The packages which are not required by the system are known as orphaned packages.

The most appropriate way to clean up your system would be using apt-get autoremove. This command deletes all the packages that your system doesn’t need anymore:

sudo apt-get autoremove

Enter the root user password and then type Y to confirm the uninstallation process.

If you have very little space left on your computer, you can choose to delete the downloaded archive files using the apt-get clean command.

sudo apt-get clean

Note that broken packages also eat up a huge chunk of your system storage. Therefore, it is important that you know how to fix broken packages on Linux.

Managing Packages on Linux With Apt

Advanced Packaging Tool (or simply Apt) provides all the important utilities that you need for managing packages on your system. You can install, uninstall, purge, and clean up packages using this tool.

If you are new to Linux, then knowing which distribution is the best for you is essential. Several websites are available that allow you to run and test Linux distributions right from your browser.

Source: makeuseof.com

Related posts

Learn From My Mistakes: Don’t Buy the Wrong OLED Monitor

Steam Has Closed a Refund Loophole: Here’s How It Will Affect You

Platform-Exclusive Games Might Be a Thing of The Past: Here’s Why That’s Good