Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Disk space on my root partition is running low, so I want to delete some applications from the system. How can I see which software packages use the most disk space? Is it possible to view that from aptitude?

I know about generic disk space analyzers like df or baobab, but I need solutions for installed applications.

share|improve this question

6 Answers 6

up vote 11 down vote accepted

Easiest is to run wajig large. The package should be an apt-install-away.

Here's two links for other ways of doing it:

Also remember that the installed size is just part of the space taken up by packages. The compressed version is probably still in the cache, and that takes up some space too. Don't recall what the command is to purge the cache off the top of my head.

share|improve this answer
The command to empty the package cache is apt-get clean. “clears out the local repository of retrieved package files” – man apt-get –  manatwork Jun 10 '12 at 17:07

The easiest way (without installing extra packages) is:

dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n

which displays packages in size order, largest package last.

share|improve this answer

First of all, use a tool like baobab (sudo apt-get install baobab) to show you where that space is being used:

enter image description here

That will give you a nice graphical overview and help you narrow down what is taking up your space. You can also get this information on the command line using du:

$ sudo du -ch /

Pass this through sort (assuming GNU sort, whicih should be the case in Debian) to sort by directory size:

$ sudo du -ch / | sort -h

As a next step, you can see how much space a particular package is using with this command:

$ sudo apt-get --assume-no --purge remove "PACKAGE_NAME" | grep "be freed" | 
   awk '{print $4, $5}' 

On my system, for example, removing all texlive packages will free 1,502 MB:

$ sudo apt-get --assume-no --purge remove "texlive*" | grep "be freed" | 
   awk '{print $4, $5}' 
1,502 MB

Finally, you can get this information for all installed packages with this command:

$ for i in $(dpkg -l | awk '($1=="ii"){print $2}'); do  
    echo -e "$i\t"$(sudo apt-get --assume-no --purge remove "$i" | 
                    grep "be freed" | awk '{print $4, $5}'); 
share|improve this answer
And then there is aptitude awesomesauce :P –  Braiam Jan 22 '14 at 17:31

And of course there is aptitude awesomeness:

aptitude -F'%p %I' search texlive
texlive                                                       93.2 kB 
texlive-base                                                  44.1 MB 
texlive-bibtex-extra                                          52.4 MB 
texlive-binaries                                              13.0 MB 
texlive-binaries:amd64                                        13.5 MB 
texlive-doc-ar                                                92.2 kB 
texlive-doc-bg                                                92.2 kB 
texlive-doc-cs+sk                                             92.2 kB 
texlive-doc-de                                                92.2 kB 
texlive-doc-en                                                92.2 kB 
texlive-doc-es                                                92.2 kB 
texlive-doc-fi                                                92.2 kB 
texlive-doc-fr                                                92.2 kB 
texlive-doc-it                                                92.2 kB 
texlive-doc-ja                                                92.2 kB 
texlive-doc-ko                                                92.2 kB 
texlive-doc-mn                                                92.2 kB 
texlive-doc-nl                                                92.2 kB 
texlive-doc-pl                                                92.2 kB 
texlive-doc-pt                                                92.2 kB 
texlive-doc-rs                                                92.2 kB 

The key here is the -F which formats the output, the %p shows the package name and %I the installed size. You should use this instead to show only installed packages:

aptitude -F'%p %I' search '~i'

Or to sort by install size:

aptitude -O installsize -F'%p %I' search '~i'

It's also useful to change the default view in the interactive aptitude to include that information. To do that:

  • Click or navigate to Options->Preference
  • scroll to The display format for package views
  • Add %I in the value like %c%a%M%S %p %Z %t %I %v %V

You can also sort by installed-size by pressing Shift-S and enter installsize in the dialog box. Then, you can limit the view to only installed packages by pressing l (lowercase L) and enter ~i.


share|improve this answer
Not sure if there is a way to do it, but it'd be nice to always print size in kB, that'd make it much easier to sort or otherwise postprocess. –  derobert Jan 22 '14 at 17:31
Nice, +1. Can you think of an easy way to show the total space freed? –  terdon Jan 22 '14 at 17:35
@derobert was looking how I could control the white space in the output of aptitude, also, apparently there's no way to change the output of size. –  Braiam Jan 22 '14 at 17:39
@Braiam yes, what is the total amount of space gained if I remove *texlive*? –  terdon Jan 22 '14 at 17:43
@terdon mm... wouldn't aptitude -s remove '?and(texlive,~i)' be enough? Also, you can add a user-tag to certain package so you can manipulate them as whole (like the tasks). –  Braiam Jan 22 '14 at 17:46

You can use the wajig package, and the command

wajig large

The help explains what this does.

wajig large -h

usage: wajig large [-h]

List size of all large (>10MB) installed packages

See also the project page.

share|improve this answer

In case you don't want to install wajig. I imagine everybody has debian-goodies installed:

dpigs              - Show which installed packages occupy the most space
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.