Tired of running of low disk space? You may need to check for unused packages, in other term orphaned packages , filled in your hard drive. Orphaned (unused) packages are nothing but the packages which will be installed as a dependencies/libraries when you install a software in your linux box. As you know already, whenever we install an application, some other packages (dependencies) will also be installed along with the original application. These dependencies might exist in your hard drive even though you removed the application. After a particular period of time, your hard drive will be flooded with unused or orphaned packages, and you might end up with low disk space. Low disk space not only affects the system performance, it will also not let you to install new applications due to low disk space. So, it is very recommended to wipe out the orphaned packages in regular interval.
This brief tutorial will explain you how to remove unused, or unwanted, or orphaned packages in popular Linux distributions such as CentOS and Ubuntu. First, we will see how to find and remove unused packages in Ubuntu and its derivatives such as Linux Mint, elementary OS.
Find and remove unused packages in Ubuntu using DeborphanDeborphanis a command-line utility that can be used to find and remove unused or orphaned packages in DEB based systems. It is available in the official repositories. To install it, open up the Terminal and run the following command:
sudo apt-get install deborphanOnce installed, run it as shown below to find out the orphaned packages.
deborphanThis will list all the unused packages.
openoffice.org-hyphenationrhythmbox-plugin-magnatune
myspell-en-gb
libgnutls-openssl27
myspell-en-za
libusb-0.1-4
libreadline6
As you see above, I have few unused packages in my Ubuntu system.
To remove the orphaned packages, run:
sudo orphanerSelect the files and select Ok to remove the all fines.
Find and remove unused packages in Ubuntu using GtkorphanGtkorphanis the graphical tool that allows us to find and remove orphaned packages. Gtkorphan is only for desktop editions. If you’re using Ubuntu server without GUI, use Deborphan instead.
Gtkorphan is available in the default repositories. To install it, run:
sudo apt-get install gtkorphanOnce installed, launch it by running the following command from the Terminal:
sudo gtkorphanGtkorphan’s default interface will look like below.
Since we already removed the orphaned packages, it shows nothing. However, at the first time, we need to initialize the system in order to keep track of needed packages, even if they are listed as orphaned.
To do so, from the main window, expand the“Options” section and check the box that says “Show all orphan packages, not only those in the libs section” .
Now, Gtkorphan will list the orphaned packages. However, you must careful here. As you see in the above picture, Gtkorphan lists some important packages as unused. We mustn’t remove them. In order to keep the important packages, right click on the package name, and click Hibernate package option.
This will keep the packages from removal by Gtkorphan. You only need to do this at the first time. After that, you can remove the orphaned packages if any exists.
Once you hibernated all important packages, scroll down through the list of other packages. If you don’t need any package, just rght click on it and click “Select for removal” option.
Alternatively, run the following command to remove the unused/orphaned packages all at once.
sudo apt-get autoclean && sudo apt-get autoremoveCongratulations! Now, you have free up some space in your hard drive.
Download Free EBook: “Ubuntu Documentation: Ubuntu Server Guide 2014”
Find and remove unused packages in Ubuntu using rpmorphanRpmorphanis a command line utility that can be used to find orphaned packages in RPM based systems, such a RHEL, CentOS, Fedora, Scientific Linux, SUSE etc.
Rpmorphan consists of the following useful tools:
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.Before installing Rpmorphan, make sure you have installed Perl and perl-Tk packages. To install these packages, run:
yum install perl perl-TkThen, download Rpmorphan package from the following link. As of writing this, the latest version was 1.16 .
Download rpmorphanOnce downloaded, install rpmorphan using command:
rpm -Uvh rpmorphan-1.16-1.noarch.rpmAfter installing rpmorphan, run it to find the orphaned libraries:
rpmorphan Sample output: libsysfsIt’s also possible to display the orphaned packages of a specific period.
For example, to display all orphaned packages, installed in the last 2 days:
rpmorphan --all -install-time -2 Sample Output: rpmorphanwget
Display all orphaned packages, installed 10 days ago (or more):
rpmorphan --all -install-time +5 Sample output: NetworkManager-adslNetworkManager-bluetooth
NetworkManager-glib
NetworkManager-team
NetworkManager-tui
NetworkManager-wifi
aic94xx-firmware
audit
authconfig
avahi
biosdevname
btrfs-progs
dnf-plugins-core
dracut-config-rescue
e2fsprogs
epel-release
firewalld
gpg-pubkey
grub2
iprutils
irqbalance
ivtv-firmware
iwl100-firmware
iwl1000-firmware
iwl105-firmware
iwl135-firmware
iwl2000-firmware
iwl2030-firmware
iwl3160-firmware
iwl3945-firmware
iwl4965-firmware
iwl5000-firmware
iwl5150-firmware
iwl6000-firmware
iwl6000g2a-firmware
iwl6000g2b-firmware
iwl6050-firmware
iwl7260-firmware
kbd
kernel
kernel-tools
kexec-tools
libsysfs
lvm2
man-db
microcode_ctl
openssh-clients
openssh-server
parted
passwd
postfix
python-setuptools
rootfiles
rsyslog
selinux-policy-targeted
sudo
tar
tuned
xfsprogs
Display all unused packages since 10 days or more:
rpmorphan --all --access-time 10 Sample output: NetworkManager-glibNetworkManager-tui
aic94xx-firmware
btrfs-progs
dracut-config-rescue
e2fsprogs
gpg-pubkey
grub2
ivtv-firmware
iwl100-firmware
iwl1000-firmware
iwl105-firmware
iwl135-firmware
iwl2000-firmware
iwl2030-firmware
iwl3160-firmware
iwl3945-firmware
iwl4965-firmware
iwl5000-firmware
iwl5150-firmware
iwl6000-firmware
iwl6000g2a-firmware
iwl6000g2b-firmware
iwl6050-firmware
iwl7260-firmware
libsysfs
man-db
microcode_ctl
openssh-clients
parted
passwd
python-setuptools
sudo
tar
For more examples, refer the man pages.
man rpmorphanIf you no longer need those orphaned packages, just remove them using yum command and free up your hard drive.hard drive.
That’s it. I will be here with another interesting tutorial soon. Until then, stay tuned with OS