Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Before i try to install a program in ubuntu, where can i see how much disk space the package including the needed dependency packages will need. Perhaps a commandline way?

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

apt-get will show this by default.

example:

sudo apt-get install kde-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  akonadi-server akregator amor ark aurorae-themes-artwork avogadro-data blogilo bomber bovo cantor cantor-backend-kalgebra
  cervisia cvs cvsservice dolphin dragonplayer gnugo gnupg-agent gnupg2 granatier graphviz gwenview jovie juk kaddressbook
  kajongg kalarm kalgebra kalzium kalzium-data kamera kanagram kapman kapptemplate katomic kbattleship kblackbox kblocks
  kbounce kbreakout kbruch kbugbuster kcachegrind kcalc kcharselect kcolorchooser kde-config-cddb kde-config-cron

       [ Output truncated ]

 python-avogadro python-dateutil python-enchant python-iniparse python-kde4 python-levenshtein python-lxml python-pyasn1
  python-qt4-dbus python-qt4-sql python-twisted python-twisted-conch python-twisted-lore python-twisted-mail
  python-twisted-news python-twisted-runner python-twisted-words python-utidylib python-vobject rocs setserial step
  subversion sweeper system-config-printer-kde systemsettings translate-toolkit ttf-dustin umbrello valgrind xplanet
  xplanet-images
0 upgraded, 349 newly installed, 0 to remove and 0 not upgraded.
Need to get 376MB of archives.
After this operation, 815MB of additional disk space will be used.
Do you want to continue [Y/n]

At the bottom you can see that the total size to fetch from internet is 376MB and after installation it will use 815MB of disk space.

If you are ok with this type 'Y' to continue the installation or type 'n' to cancel the installation.

share|improve this answer
add comment

You can simply use the Ubuntu Software Centre. It shows how much you have to download (inclusive of undownloaded dependencies) and the also the size when installed.

share|improve this answer
add comment

This isn't really directly possible in any tool that I know of.

Synaptic can show you the required disk space for a given package (Right-click -> Properties, bottom two lines), but I'm pretty sure that number doesn't recursively work out what each dependency requires.

More promising is that it's possible to use apt-cache to get useful CLI output for any given package. Parsing the output of this command with a bit of scripting, could work out the recursive space requirements for you. Whether the effort involved in writing such a script is up to you.

The commands in question: apt-cache show <pkgname> apt-cache depends <pkgname>

It's a bit brute-forcey, but I reckon your best bet is to:

  • Process the show command for the root package and get the output from the Installed-Size line
  • Process the depends command for the root package and repeat the parsing of show for each package on the Depends lines
  • Iterate over these until you've got all the dependencies worked out
  • Add all the numbers together

Kind of messy, but I'm just not sure it's do-able with a single command.

share|improve this answer
add comment

Your Answer

 
discard

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.