When we run apt, apt-get or aptitude we always know how much space would be needed in / and it's children (excepting /home/$username of course) .

Now when we do an apt-get source (in userspace) there is no way to know the size of source files before downloading them so as not run into any last minute surprises.

I would share a real example to describe the issue.

The binary unknown-horizons is approximately 305 MB uncompressed -

[$] aptitude show unknown-horizons

Package: unknown-horizons                
Version: 2014.1+git160920-1
State: installed
Automatically installed: no
Priority: optional
Section: games
Maintainer: Debian Games Team <[email protected]>
Architecture: all
Uncompressed Size: 305 M
Depends: ttf-unifont, python, python-enet, python-fife (>= 0.3.5+git160920), python-yaml, python:any (< 2.8), python:any (>= 2.7.5-5~)
Description: 2D realtime strategy simulation
 Unknown Horizons is a 2D realtime strategy simulation with an emphasis on economy and city building. Expand your small settlement to a strong
 and wealthy colony, collect taxes and supply your inhabitants with valuable goods. Increase your power with a well balanced economy and with
 strategic trade and diplomacy.
Homepage: http://www.unknown-horizons.org

Now if I were to download the source, it either would be downloading the whole 305 MB or more uncompressed packages or just the /debian directory which would hardly be an MB or more. Is there a way to do that ?

I am guessing it either would need metadata like apt-file does -

$ sudo apt-file update 

1 Answer 1


You can find out the size of the source tarballs using apt-cache showsrc:

$ apt-cache showsrc unknown-horizons
Package: unknown-horizons
Binary: unknown-horizons
Version: 2014.1+git160920-1
Maintainer: Debian Games Team <[email protected]>
Uploaders: Christoph Egger <[email protected]>
Build-Depends: debhelper (>= 10), dh-python, docbook-xml, docbook-xsl, imagemagick, intltool, python, xsltproc
Architecture: all
Standards-Version: 3.9.8
Format: 3.0 (quilt)
 152652f8ecb6961a5f02d3cab67b8cfa 2290 unknown-horizons_2014.1+git160920-1.dsc
 bec6e49f621f3f961454cf41c7e13346 197217496 unknown-horizons_2014.1+git160920.orig.tar.xz
 dccaafd51d0fbe3aaebe874715bc1d93 12512 unknown-horizons_2014.1+git160920-1.debian.tar.xz
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-games/unknown-horizons.git
Vcs-Git: https://anonscm.debian.org/git/pkg-games/unknown-horizons.git
 af9fc7592567b75fa84189ca4e823df103e74fcb51e3fe34ea1162a53d08434d 2290 unknown-horizons_2014.1+git160920-1.dsc
 9342154d2ede6e152175c1c69d84f3a51ba2704a77a286103590da40f0d02482 197217496 unknown-horizons_2014.1+git160920.orig.tar.xz
 c6db7500f4dfe4a544ae660f92dd9acdc8248ecdc798a45d4bce0be6992d8a6f 12512 unknown-horizons_2014.1+git160920-1.debian.tar.xz
Homepage: http://www.unknown-horizons.org
 unknown-horizons deb games optional arch=all
Directory: pool/main/u/unknown-horizons
Priority: source
Section: games

Note the Files: entries: the .orig tarball (containing the upstream source) is 188MiB in size, the .debian tarball 12KiB. This doesn't tell you how much space is needed to extract the tarballs, but it gives some indication.

You can download only the debian directory by only downloading the .debian tarball, either from the source package's page, or using apt-get source --diff-only.

You must log in to answer this question.

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