How to compute program size?

Posted on

Problem :

I’d like to have a reasonable computation of how much diskspace a certain program uses.
Like so:

// Fiction
$ aptitude size -h latex 
folder1    250MB
folder2     15MB
total      265MB

Any kind of help will be appreciated. Maybe some listing of folders used by a specific program and then du?


Solution :

You can query the local package database for the size of the package after it is installed:

apt-cache show <package> | grep Installed-Size

This won’t include the size of an run-time generated data (e.g., querying for mysql-server-5.5 will return the size of the mysql server application, not including the size of any mysql databases). The information of which files to include in those size calculations would be dependent on the specific version of the specific package, and since that information is not kept in a general database, there’s probably not a general solution for calculating it.

Note, if you’re getting really small sizes for some packages, make sure you’re not looking at an alias (e.g., mysql-client vs mysql-client-5.5)

Leave a Reply

Your email address will not be published. Required fields are marked *