How To List Installed Packages By Size (Largest) On Linux

When you are running an out of space in your system, you might want to check who’s major contributor to get out of the issue. This can be analyzed in two ways.

Initially everyone try to find out the large files, it could be log files, etc. The other one is application/packages installed size but most of us won’t think about this.

However, it’s also one of the reason and you have to remember this when you are in this situation.

is it easy to identify? yes but you need to understand few things that’s it rest all are as usual.

In Linux, package manager is one of the important tool, which allows users to perform most of the action such as package installation, remove, search, upgrade, etc,. It’s a handy tool.

Package manager is playing a major role in this activity so, we should have hands on experience in the package management tool.

Below are the famous package managers for Linux.

How To List Installed Packages By Size In CentOS/RHEL/Fedora Systems Using rpm Command

RHEL, CentOS, openSUSE & Fedora systems are using RPM packages hence we can use the rpm Package Manager to get this information.

RPM stands for Red Hat Package Manager is a powerful, command line Package Management utility for Red Hat based system such as CentOS, Oracle Linux & Fedora, Some of the other Linux distributions also using RPM packages openSUSE, Mageia & Scientific Linux.

The RPM utility allow you to install, upgrade, remove, query & verify the packages on Linux system/server.

RPM files comes with .rpm extension. RPM package built with required libraries and dependency which will not conflicts other packages were installed on your system.

# rpm -qa --queryformat '%10{size} - %-25{name} \t %{version} \t %{os} \n' | sort -rh | head -25 | awk '{print $1/1024/1024, $2, $3, $4}'
133.078 - kernel 2.6.32
131.008 - kernel 2.6.32
131.003 - kernel 2.6.32
107.227 - glibc-common 2.12
102.25 - java-1.8.0-openjdk-headless
58.1633 - kernel-firmware 2.6.32
40.1377 - samba-client 3.6.23
39.3547 - python36u-libs 3.6.5
38.1399 - rh-python35-python-libs 3.5.1
36.4767 - samba-common 3.6.23
33.6483 - perl 5.10.1
21.9148 - python-libs 2.6.6
21.1606 - vim-common 7.4.629
18.5959 - gcc 4.4.7
15.0838 - redhat-logos 60.0.14
14.5824 - git 1.7.1
12.5136 - glibc 2.12
12.2767 - coreutils 8.4
10.754 - iso-codes 3.16
9.73368 - postfix 2.6.6
9.54788 - cpp 4.4.7
9.37589 - binutils
9.00094 - selinux-policy 3.7.19
8.89512 - cracklib-dicts 2.8.16
8.75903 - nagios 4.3.4

How To List Installed Packages By Size In Debian/Ubuntu Systems Using dpkg-query Command

Debian/Ubuntu based systems are using DEB packages hence we can use the dpkg Package Manager to get this information.

dpkg stands for Debian package manager (dpkg). dpkg is a command-line tool to install, build, remove and manage Debian packages. dpkg uses Aptitude (primary and more user-friendly) as a front-end to perform all the actions.

Other utility such as dpkg-deb and dpkg-query uses dpkg as a front-end to perform some action.

$ dpkg-query --show --showformat='${Installed-Size}\t${Package}\n' | sort -rh | head -25 | awk '{print $1/1024, $2}'
257.928 openjdk-9-jre-headless
220.642 linux-modules-4.16.7-041607-generic
205.605 linux-firmware
179.729 google-chrome-stable
172.762 docker-ce
160.827 firefox
157.745 linux-image-extra-4.13.0-46-generic
157.745 linux-image-extra-4.13.0-45-generic
157.743 linux-image-extra-4.13.0-43-generic
157.74 linux-image-extra-4.13.0-39-generic
157.74 linux-image-extra-4.13.0-38-generic
127.182 libreoffice-core
122.828 libgl1-mesa-dri
121.062 thunderbird
120.862 papirus-icon-theme
111.339 golang-1.8-go
95.3184 openjdk-8-jre-headless
89.8867 inkscape
84.6797 fonts-noto-cjk
72.3418 linux-headers-4.16.7-041607
71.9678 linux-headers-4.13.0-46
71.9678 linux-headers-4.13.0-45
71.9648 linux-headers-4.13.0-43
71.9541 linux-headers-4.13.0-39
71.9434 linux-headers-4.13.0-38

How To List Installed Packages By Size In Debian/Ubuntu Systems Using aptitude Command

Aptitude is a text-based interface to the Debian GNU/Linux package system. It allows the user to view the list of packages and to perform package management tasks such as installing, upgrading, and removing packages. Actions may be performed from a visual interface or from the command-line.

$ aptitude search "~i" --display-format "%p %I" --sort installsize | tail -25
linux-image-4.13.0-46-generic 72.6 MB
linux-headers-4.13.0-38 75.4 MB
linux-headers-4.13.0-39 75.4 MB
linux-headers-4.13.0-43 75.5 MB
linux-headers-4.13.0-46 75.5 MB
linux-headers-4.13.0-45 75.5 MB
linux-headers-4.16.7-041607 75.9 MB
fonts-noto-cjk 88.8 MB
inkscape 94.3 MB
openjdk-8-jre-headless 99.9 MB
golang-1.8-go 117 MB
papirus-icon-theme 127 MB
thunderbird 127 MB
libgl1-mesa-dri 129 MB
libreoffice-core 133 MB
linux-image-extra-4.13.0-39-generic 165 MB
linux-image-extra-4.13.0-38-generic 165 MB
linux-image-extra-4.13.0-43-generic 165 MB
linux-image-extra-4.13.0-45-generic 165 MB
linux-image-extra-4.13.0-46-generic 165 MB
firefox 169 MB
google-chrome-stable 194 MB
docker-ce 197 MB
linux-firmware 216 MB
linux-modules-4.16.7-041607-generic 231 MB

How To List Installed Packages By Size In Debian/Ubuntu Systems Using dpigs Command

dpigs sorts the installed packages by size and outputs the largest ones. Per default dpigs displays the largest 10 packages. You can change this value by using the -n option.

$ dpigs -H
 220.6M linux-modules-4.16.7-041607-generic
 205.6M linux-firmware
 179.7M google-chrome-stable
 172.8M docker-ce
 160.8M firefox
 157.7M linux-image-extra-4.13.0-46-generic
 157.7M linux-image-extra-4.13.0-45-generic
 157.7M linux-image-extra-4.13.0-43-generic
 157.7M linux-image-extra-4.13.0-39-generic
 157.7M linux-image-extra-4.13.0-38-generic

How To List Installed Packages By Size In Debian/Ubuntu Systems Using wajig Command

Wajig is a simplifed and more unified command-line interface for package management. It adds a more intuitive quality to the user interface. Wajig also provides a graphical user interface, known as gjig.

$ wajig size | tail -25 | sed -e 's:,::g' | awk '{print $1, $2/1024}'
linux-headers-4.13.0-38 71.9434
linux-headers-4.13.0-39 71.9541
linux-headers-4.13.0-43 71.9648
linux-headers-4.13.0-45 71.9678
linux-headers-4.13.0-46 71.9678
linux-headers-4.16.7-041607 72.3418
fonts-noto-cjk 84.6797
inkscape 89.8867
openjdk-8-jre-headless 95.3184
golang-1.8-go 111.339
papirus-icon-theme 120.862
thunderbird 121.062
libgl1-mesa-dri 122.828
libreoffice-core 127.182
linux-image-extra-4.13.0-38-generic 157.74
linux-image-extra-4.13.0-39-generic 157.74
linux-image-extra-4.13.0-43-generic 157.743
linux-image-extra-4.13.0-46-generic 157.745
linux-image-extra-4.13.0-45-generic 157.745
firefox 160.827
docker-ce 172.762
google-chrome-stable 179.729
linux-firmware 205.605
linux-modules-4.16.7-041607-generic 220.642
openjdk-9-jre-headless 257.928

How To List Installed Packages By Size In Arch Linux based Systems Using pacman Command

Arch Linux based systems are using pacman package manager hence we can use the pacman Package Manager to get this information.

pacman stands for package manager utility (pacman). pacman is a command-line utility to install, build, remove and manage Arch Linux packages. pacman uses libalpm (Arch Linux Package Management (ALPM) library) as a back-end to perform all the actions.

# pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -hr | head -25
296.64MiB linux-firmware
144.20MiB python
105.43MiB gcc-libs
72.90MiB python2
66.91MiB linux
57.47MiB perl
45.49MiB glibc
35.33MiB icu
34.68MiB git
30.96MiB binutils
29.95MiB grub
18.96MiB systemd
13.94MiB glib2
13.79MiB coreutils
13.41MiB python2-boto
10.65MiB util-linux
9.50MiB gnupg
8.09MiB groff
8.05MiB gettext
7.99MiB texinfo
7.93MiB sqlite
7.15MiB bash
6.50MiB lvm2
6.43MiB openssl
6.33MiB db

How To List Installed Packages By Size In Arch Linux based Systems Using pacgraph

Pacgraph utility allows Arch Linux users to get installed package by size.
Also, It draws a pretty picture of your installed packages.

# pacgraph -c | head -25
Autodetected Arch.
Loading package info
Total size: 1221MB
367MB linux
144MB pacgraph
98MB cloud-init
37MB grub
35MB icu
34MB git
31698kB binutils
19337kB pacman
11029kB man-db
8186kB texinfo
8073kB lvm2
7632kB nano
7131kB openssh
5735kB man-pages
3815kB xfsprogs
3110kB sudo
3022kB wget
2676kB tar
2626kB netctl
1924kB parted
1300kB procps-ng
1248kB diffutils

Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

You may also like...

Please support the site
By clicking any of these buttons you help our site to get better