Check apt package size in Ubuntu
How To

Find Apt Packages that Consume the Most Space on Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

If you are running out of space on the system, the most basic thing to do is check what is taking up how much space.

There will be several factors behind that. From logs to cache, it could be anything.

But have you ever wondered which application is taking more space? Yes, this is possible for apt packages at least.

Ubuntu 18.04 Review of New Features
Ubuntu 18.04 Review of New Features

And this guide is focused on how you can check the APT packages that consume the most space on Ubuntu.

Discover APT packages that consume the most space on Ubuntu

To find the APT packages that consume the most space, I will be using a command named dpigs.

To use dpigs, you will have to install a package named debian-goodies:

sudo apt install debian-goodies

Once you are done with the installation, all you need to do is use the dpigs command:

dpigs
find largest APT packages on Ubuntu

But to display package size in human-readable form, you will have to use the -H option as shown:

dpigs -H
get human readable output in dpigs command

And it will get you the top 10 APT packages taking the most space on your Ubuntu system.

But what if you want to list more than 10? Well, you can specify the number of packages you want using the -n option.

So let's say I want to find the top 20 APT packages taking the most space, I will be using the following command:

dpigs -H -n 20
find top 20 APT packages consuming the most space in Ubuntu

Once you find the unnecessary package, you can remove it from your system.

And for that purpose, we have a dedicated guide covering how to remove apt packages:

apt remove: Uninstall apt Packages in Ubuntu
How do you uninstall apt packages in Ubuntu using the terminal? It’s quite simple, actually. If you know the package name, just use it with the apt remove command like this: sudo apt remove package_name Even if you do not know the exact package name, tab completion is

Bonus: Find the largest source packages of binary packages on Ubuntu

The dpigs command can also find the largest source packages for you.

All you need to do is use the -S option with the dpigs command:

dpigs -H -S
find the largest source packages in Ubuntu

And that's it!

Wrapping Up

This was a quick guide on how you can find the APT packages consuming the most disk space on Ubuntu.

And if you have any queries or recommendations related to what I should cover next, let me know in the comments.



Sagar Sharma

Sagar Sharma

A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.