I was trying to get a package size installed on my Ubuntu-VM and so I tried 2 different commands: dpkg-query and apt-cache. I did that for 2 packages I previously installed: git and terminator:

For git package:

1. $ dpkg-query -Wf '${Installed-Size}\t${Package}\n' | grep git
    69  elpa-git-commit
    1446    elpa-magit
    94  elpa-magit-popup
    35680   git
    1233    git-cvs
    864 git-daemon-run
    11263   git-doc


2. $ apt-cache show git | grep '^Size:'
    Size: 4554416
    Size: 4553836

For terminator package:

3. $ dpkg-query -Wf '${Installed-Size}\t${Package}\n' | grep terminator
   Output: 2099 terminator


4. $ apt-cache show terminator| grep '^Size:'
   Output: Size: 313088

So I got a little confused. My questions:

  1. Why dpkg-query on "git" gives so many packages (containing the word 'git') while apt-cache on "git" gives ONLY 2 simple results (probably for 2 different versions)
  2. Why dpkg-query on "terminator" gives a different size than apt-cache on "terminator" package?
  • Simple command : dpkg -s git | grep Size ... and the reply is Installed-Size: ...... Dec 5, 2021 at 16:04

1 Answer 1

  1. You’re not running dpkg-query on git, you’re running dpkg-query on all packages and filtering the output on git. Try

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


  2. apt-cache’s Size field shows the package file’s size, i.e. the size of the corresponding .deb file, not the package’s installed size. Use apt show instead to see both the download size and installed size.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .