Raspberry Pi

How to Remove Unused Packages on Raspberry pi

Using a Raspberry Pi system for various applications sometimes requires the user to install many packages. Raspberry Pi does not have internal storage, so all these packages are stored in an external storage device like an SD card. There is no purpose in storing a lot of packages on SD cards that are no longer useful for your system as this impacts the performance of your device.

If you want to remove those unused packages from your Raspberry Pi system, follow this article to find out several methods for removing them.

How to Remove Unused Packages on Raspberry Pi?

You can remove unused packages on Raspberry Pi by using multiple methods which are listed below:

Let’s get into each of these methods one by one

Method 1: Autoremove Command

One of the widely used commands to remove unused packages on the Raspberry Pi system is the “autoremove” command. It removes those packages that are not used for quite long. To simply remove those packages, use the following command:

$ sudo apt autoremove -y

After running the above command your system will be cleaned from the unused packages.

Method 2: Autoclean Command

The “autoclean” command is another useful method that you can use to remove unused packages from your Raspberry Pi system. The difference between “autoremove” and “autoclean” is that the “autoremove” removes all unused packages from the system whereas the “autoclean” removes the unused packages from the source repository.

Follow the below-mentioned command to run autoclean command on your Raspberry Pi terminal:

$ sudo apt autoclean

Method 3: Command Line Utility

Deborphan is a command-line utility that can be used on the Raspberry Pi system to remove unused packages. You can install this utility using the following command:

$ sudo apt install deborphan -y

To display the list of unused packages, follow the below-mentioned command:

$ deborphan

As a result of the above command, you will get the list of unused packages on the terminal screen.

To remove these packages through deborphan, run the following command:

$ sudo orphaner

Select the package you want to remove using the “Space” button and press “OK” to remove it from your Raspberry Pi system.

Method 4: Apt Remove Command

Though this method won’t be effective in case you want to automatically remove the unused packages from your system. But this method is most used for removing any package from your system with ease. However, before removing a package, it is necessary for you to find out the list of packages. We have written a detailed article to find the list of packages installed on the Raspberry Pi system. Go and follow here.

Now to remove the required package, you can use the below-mentioned command:

$ sudo apt remove <name of package>

Note: Remember to replace the name of the package with the package name that you want to remove. In my case, I am going to remove the package “empathy” from the Raspberry Pi system.

Method 5: Purge Command

The apt remove command removes the package from your system but it doesn’t remove the configuration files of the package. Thus, you can use the “purge” command to completely remove all the traces of a package from your Raspberry Pi system:

$ sudo apt --purge remove <name of package>

That’s it for this guide!

Conclusion

There are several methods to remove unused packages on Raspberry Pi, the most used ones are “autoremove”, “autoclean” and “command-line utility”. All these methods remove unused packages from your Raspberry Pi system. However, if the user wants to manually remove a package from the system, “apt remove” and purge commands can be used for this purpose.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.