2

I was wondering if there is any way to see the total hard drive space used by any program, after the installation has been completed?

plu
  • 123
  • 1
  • 5
  • Marked as duplicate of which question exactly? – Rolf Mar 12 '19 at 11:31
  • 1
    I would disagree the question itself is a duplicate since someone who wants to know the hard drive space usage of installed programs would more directly find this question, rather than the other questions looking for other things like "size of a package while using apt prior to downloading" or "list all installed packages".

    Would there be any suggested changes I can make to this question?

    – plu Mar 14 '19 at 22:32
  • Indeed. I want to determine the total size of all installed package, not list them or print the size of a single package before downloading. – Rolf Mar 17 '19 at 14:20
  • By the way, I found my answer - using wajig, I do: wajig sizes |sed -E 's/^\S+\s+(\S+).+/\1/' | sed -E s/,// | awk '{s+=$1} END {print s}' – Rolf Mar 17 '19 at 14:27
  • well you could make your question body more consistent with the title. What exactly are asking? Do you want to see a list of installed programs? The space needed by a particular program? Or the total hard drive space used by all installed programs? The latter is what it sounded like to me, from reading the title, but then I read the body of the question and it seems that you are asking for a list. I suggest you clarify either the title or the body of the question to reflect your intent and avoid misunderstandings, please. I would appreciate it! – Rolf Mar 17 '19 at 14:35
  • 1
    @Rolf I have clarified the question. Hopefully that would be enough to not be a duplicate. – plu Mar 18 '19 at 20:28

4 Answers4

4

For a particular package:

apt-cache show <packagename> | grep -E '^(.*Size|Version|Package)'

Add or remove fields in the grep string as necessary. Since multiple versions may be present, I added the Version and Package fields as well. Note that the Installed Size field is an estimated value, in KB, whereas the Size field is for the package file and is in bytes.

Example:

apt-cache show blender | grep -E '^(.*Size|Version|Package)'
Package: blender
Version: 2.71~git201406121839.169c95b-0irie1~trusty1
Installed-Size: 140334
Size: 39108640
Package: blender
Installed-Size: 63238
Version: 2.69-4ubuntu2
Size: 18696012

To get a list of installed packages, see How to list all installed packages Essentially:

dpkg --get-selections | grep -v deinstall
muru
  • 197,895
  • 55
  • 485
  • 740
  • Thanks. I noticed that the Installed-size listing gives a slightly different number than what is shown in Synaptic. What accounts for that difference? – plu Jul 15 '14 at 18:31
  • @plu According to the Debian Policy Manual: Actual installed size may vary based on block size, file system properties, or actions taken by package maintainer scripts. for example, a package like flash-installer downloads flash in the maintainer scripts. The exact reason would depend on the package. Synaptic probably computes the total size of the all the files in the package. – muru Jul 15 '14 at 21:48
3

I am a big fan of baobab to figure out where the big files are hidden. To install:

sudo apt-get install baobab

enter image description here

noleti
  • 4,053
  • 27
  • 25
1

Here is an answer which doesn't show directly asked packages info, it is covered in other answers in this thread, but though you will probably find helpful to have a list of what takes a lot of space on your file system.

sudo du / -h|sort -n -r|less

will show you the biggest files of your / at the top of the screen. It is generally related to looking for taken space,

  • To me, this fails to answer the question as it is not related to installed programs/packages. This command will calculate the size of ~, where most programs are not. – John WH Smith Jul 14 '14 at 17:41
  • @JohnWHSmith I though by analogy one can replace ~ with / but ok, I changed it. – Ruslan Gerasimov Jul 14 '14 at 21:17
  • Again, this does not answer the question. du acts at a lower level : it measures file sizes. It can't tell the size taken by a package, or a set of packages (unless you tell it exactly where each and every file of the package is, which will probably take you some time). – John WH Smith Jul 14 '14 at 21:23
  • Generally it is related to the search for taken space. – Ruslan Gerasimov Jul 14 '14 at 21:27
1

You can do this graphically in Synaptic. if it is not installed, Install it with the command:

sudo apt install synaptic

then:

  • First ensure that you enabled the Installed Size and Download size columns (or only one if you want that one).
  • To do this, go to Settings>Preferences and choose Columns and Fonts, then tick the columns you want to see.
  • !Then click "OK".

Now whenever you will search package It will show Download size and installed size.

Rahul V Sharma
  • 480
  • 1
  • 4
  • 12