Are you troubling with full of unused packages that occupies more space and slow down your operating system performance? Well, you should try these two awesome utilities that help will you to easily find and remove the orphaned packages on your hard drive.
Well, What is an Orphaned package? Simple, Orphaned package is an unwanted package which is no longer necessary. As you may know, whenever you install a package, it will install along with other packages(dependencies). After removing the package, not all the dependencies will be removed completely. Some dependencies might still exist and dumbs the hard drive space after removing a specified package.
In this tutorial, We will discuss how to find and remove the orphaned files in Debian, and RHEL based systems.
Deborphan
As the name says, Deborphan is used to find the unwanted packages on the Debian based systems that have no other packages depending on them. The default function of this tool is to find and remove the orphaned packages, and unused libraries.
To install it on a Debian based systems, run the following command:
sudo apt-get install deborphan
To find out the orphaned packages, simply run the following command in your Terminal.
deborphan
This will list all the unused packages.
Also, deborphan has a dialog frontend called “orphaner” to remove packages easily. To open orphaner, run the following command:
orphaner
If any orphaned files found, select them, and click Ok to remove them.
Gtkorphan
Luckily, there is a graphical frontend called “gtkorphan” is available to get things done much easier. It is available in the default reposiotires, so that we don’t have to manually download and install it.
To install it, just run the following command:
sudo apt-get install gtkorphan
To open up the gtkorphan, run the following command with root privileges.
sudo gtkorphan
First of all, you must initialize your system in order to keep track of needed packages, even if they are reported as orphaned. To do that, In the main window, expand the “Options” section and check the “Show all orphan packages, not only those in the libs section” checkbox.
As you see in the above screen shot, some important packages are shown as orphan. To keep the important packages, and don’t want to be reported as orphaned, right click on the package name, and click Hibernate package option.
Now, you won’t these important packages in the Orphaned packages list. The Gtkorphan will keep these packages and will not shown them anymore. This action should be performed at Gtkorphan’s first run. After that, you can remove the orphaned packages if any exists.
And finally, you guessed it right. We can clean unused packages using the following commands as well.
sudo apt-get autoclean && sudo apt-get autoremove
Rpmorphan
As the name says, rpmorphan is intended to RPM based distributions, such as RHEL, CentOS, SUSE etc. This will help you to find and remove the unused (orphaned) packages and libraries on your system.
Rpmorphan has the following useful tools too.
- rpmusage : display rpm packages last use date.
- rpmdep : display the full dependency of an installed rpm package.
- rpmduplicates : find programs with several version installed.
- rpmextra : find installed packages not in distribution.
Perl is needed to install and use rpmorphan. So install it if don’t have already as shown below.
yum install perl
Now, let us download the rpmorphan package from this link. After downloading it, go to the download location, and install rpmorphan package as shown below.
rpm -Uvh rpmorphan-1.15-1.noarch.rpm
Rpmorphan is as simple as Deborphan. Here is some examples.
To display orphaned libraries, run the following command:
rpmorphan
Sample output:
libertas-sd8686-firmware libertas-sd8787-firmware libertas-usb8388-firmware
To display all orphaned packages, installed in the last 2 days:
rpmorphan --all -install-time -2
Sample Output:
NetworkManager-tui epel-release iwl100-firmware iwl1000-firmware iwl105-firmware iwl135-firmware iwl2000-firmware iwl2030-firmware iwl3160-firmware iwl3945-firmware iwl4965-firmware iwl5000-firmware
To display all orphaned packages, installed 10 days ago (or more):
rpmorphan --all -install-time +10
Sample output:
aic94xx-firmware audit authconfig biosdevname btrfs-progs dracut-config-rescue e2fsprogs firewalld gpg-pubkey grub2 iprutils irqbalance
To display all unused packages since 10 days or more, use the following command:
rpmorphan --all --access-time 10
Sample output:
iwl100-firmware iwl1000-firmware iwl105-firmware iwl135-firmware iwl2000-firmware iwl2030-firmware iwl3160-firmware iwl3945-firmware iwl4965-firmware iwl5000-firmware iwl5150-firmware
If you no longer need or use them, just remove them to gain up more free space on your hard drive.
That’s all for now. Good luck!
Source & Reference Links: