amazon media file explorer download upload index folder image licenses menu widget Play Pause profile-settings more dots-two-horizontal dots-two-vertical more-vertical pending google-plus hangouts facebook instagram whatsapp spotify telegram twitter vine renren rss youtube twitch vimeo flickr dribble behance deviantart 500px steam github soundcloud skype reddit linkedin lastfm delicious stackoverflow pinterest xing flattr foursquare yelp World

Finding & Removing Orphaned Apt Packages in Ubuntu

When you install software packages (e.g Nginx) in Ubuntu or Debian, the software would most likely depend on other packages to run, so, if the packages that it depends on aren't installed, it is going to install it.

But if you remove the software package, the dependable packages will not be removed automatically, and that's where the orphaned term arose from. It basically means the package is no longer needed on your system.

Let's take a scenario. If you try installing Nginx or any other software packages, Ubuntu will remind you periodically as you use the apt tools, for example:

sudo apt install nginx

Output

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fakeroot g++ g++-7 gcc gcc-7 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4
  libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-7-dev
  libgomp1 libitm1 liblsan0 libmpx2 libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev manpages-dev
Use 'apt autoremove' to remove them.
...

It is basically telling us the packages were installed as a dependency on other packages and are no required because the software they depend on has been removed. The system now thinks they can safely be removed.

In fact, if you try uninstalling a package, it is still gonna remind you of the orphaned packages, that's one way to find out packages that aren't needed anymore.

To remove the orphaned packages, you can use the apt autoremove command as root to remove them.

Another way to remove unused packages is by using aptitude, which gives you tons of flexibility on how you choose to remove the packages...

Find and Remove Unused Packages Using Aptitude

To get started with aptitude, you'll need to install it:

sudo apt install aptitude

If you recall, the system shows you some packages that are no longer required, which you can automatically remove using the apt autoremove command, what if you would rather not remove a specific package, aptitude to the rescue.

You uncheck the package from automatically installed:

sudo aptitude unmarkauto <packagename>

Once you've done that, the package would no longer be a candidate for autoremove and thus, you can use autoremove command to remove the other packages without it removing the one you just unmarked.

As an added alternative, you can use the graphical interface that comes bundled with aptitude to manage packages, to use the graphical interface, you simply run sudo aptitude.

Aptitude gui

You can see how sweet it is to manage packages in aptitude, you can browse packages that are split into different categories. For example, you can go to the installed package, and remove some packages you don't or you can even unmark multiple packages as automatically installed, and when you use the autoremove command, they are still preserved.

I'll write more guide on using aptitude, till then.

 

Related Post(s)

  • How To Access Windows 10 Drive/Folder in VirtualBox

    To access Windows drive or folder in your Guest OS, you first of all, install VirtualBox guest utilities: sudo apt-get install virtualbox-guest-utils You then Add a shared folder by going into: Setti

  • Send Mail with Attachment Using Mutt in GNU/Linux

    Mutt is a powerful text&#x2d;based mail client for Unix/Linux operating systems. It features color support, message threading, MIME support...

  • Using Pageant To Automatically Authenticate SSH key in Putty

    I can't count how many times I have typed my ssh key passphrase whenever my ssh connection times out, it is so annoying and repetitive. Well, thanks to the putty pageant, you can do that seamlessly.

  • Installing WP-CLI In a GNU/Linux Server

    WP-CLI is a command-line interface for WordPress. It can also be used with ClassicPress, as they are no differences in their usage, maybe just minimal if you are updating or downloading new ClassicPr

  • How To Send Mail To Multiple Addresses Using (mailx)

    In this guide, you'll learn a couple of ways you can send mail to multiple addresses using mailx. mailx is a utility program for sending and receiving mail. I assume you already have mailx command, i

  • Mounting and Unmounting Cloud Storage With (Rclone) in GNU/Linux

    Ever wondered if you could mount your preferred cloud storage as a virtual drive on your system? Thanks to Rclone, you can mount and access different kinds of cloud storage from a file manager, I'll