I am wondering whether there is a command line tool that one can use to download a package from a source (standard Ubuntu or PPA sources)?

I know that packages I just installed are found in /var/cache/apt/archives and I thus can check out the package from there.

However, if I installed the package a long time ago, I don't want to reinstall it, just check a few things in the source package, how can I get easily a hold of it without having to search for it on the Internet?

  • You want to download a .deb file of the package? – Seth Jan 14 '14 at 18:15
  • Yes, just download and not install it. That way I can peruse the package. – Alexis Wilke Jan 14 '14 at 18:19

If you know the package name you can use apt to either get the source or the binary:

apt-get download packageName  

Will download the binary to the current directory.

apt-get source packageName  

Will download the source code of packageName to the current directory.

  • Ah! I know of the source command, I did not know the download one. I checked the manual page and missed it... – Alexis Wilke Jan 14 '14 at 18:20
  • 2
    Just a heads up... sometimes the manual can be overwhelming. I simply do a 'apt-get <tab> <tab>' and see all the options. – Atari911 Jan 14 '14 at 18:24

You can use apt-get install --print-uris package since this also will give you how to download all the dependencies:

apt-get install --print-uris evolution
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  bogofilter bogofilter-bdb bogofilter-common evolution-common
  evolution-plugins libevolution libgsl0ldbl libgtkhtml-4.0-0
  libgtkhtml-4.0-common libgtkhtml-editor-4.0-0 libpst4 libytnef0
Suggested packages:
  db5.1-util doc-base evolution-ews evolution-plugins-experimental
  gsl-ref-psdoc gsl-doc-pdf gsl-doc-info gsl-ref-html
The following NEW packages will be installed:
  bogofilter bogofilter-bdb bogofilter-common evolution evolution-common
  evolution-plugins libevolution libgsl0ldbl libgtkhtml-4.0-0
  libgtkhtml-4.0-common libgtkhtml-editor-4.0-0 libpst4 libytnef0
0 upgraded, 13 newly installed, 0 to remove and 12 not upgraded.
Need to get 12.5 MB of archives.
After this operation, 63.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
'http://ftp.us.debian.org/debian/pool/main/g/gtkhtml4.0/libgtkhtml-4.0-common_4.6.6-2_all.deb' libgtkhtml-4.0-common_4.6.6-2_all.deb 378210 MD5Sum:d1653f7bb0dd99a3309f5972a1c663a7
'http://ftp.us.debian.org/debian/pool/main/g/gtkhtml4.0/libgtkhtml-4.0-0_4.6.6-2_i386.deb' libgtkhtml-4.0-0_4.6.6-2_i386.deb 347140 MD5Sum:75b9b5063b2dfac8fb8051e56cf5a912
'http://ftp.us.debian.org/debian/pool/main/g/gtkhtml4.0/libgtkhtml-editor-4.0-0_4.6.6-2_i386.deb' libgtkhtml-editor-4.0-0_4.6.6-2_i386.deb 137156 MD5Sum:e81f57d363b85437a7dee14c9998544f
'http://ftp.us.debian.org/debian/pool/main/liby/libytnef/libytnef0_1.5-6_i386.deb' libytnef0_1.5-6_i386.deb 19306 MD5Sum:0abe272e79e68ef1363709e552800d37
'http://ftp.us.debian.org/debian/pool/main/e/evolution/libevolution_3.8.5-2+b1_i386.deb' libevolution_3.8.5-2+b1_i386.deb 2063408 MD5Sum:bbb131799011ba8e043d670088121293
'http://ftp.us.debian.org/debian/pool/main/e/evolution/evolution-common_3.8.5-2_all.deb' evolution-common_3.8.5-2_all.deb 7621194 MD5Sum:1707c418f80e4e9eb53d16e455a712c9
'http://ftp.us.debian.org/debian/pool/main/e/evolution/evolution_3.8.5-2+b1_i386.deb' evolution_3.8.5-2+b1_i386.deb 238110 MD5Sum:d9aa09c6b460404162e0672ba39093f1
'http://ftp.us.debian.org/debian/pool/main/libp/libpst/libpst4_0.6.59-1_i386.deb' libpst4_0.6.59-1_i386.deb 83814 MD5Sum:5b9749e3e22ab78331b0baf824071e76
'http://ftp.us.debian.org/debian/pool/main/b/bogofilter/bogofilter-common_1.2.4+dfsg1-2_all.deb' bogofilter-common_1.2.4+dfsg1-2_all.deb 184480 MD5Sum:fefc9ea5cf24be409cb318130242f2dc
'http://ftp.us.debian.org/debian/pool/main/g/gsl/libgsl0ldbl_1.16+dfsg-1_i386.deb' libgsl0ldbl_1.16+dfsg-1_i386.deb 986202 MD5Sum:d3bb41a6218035eb062749f7ec905f08
'http://ftp.us.debian.org/debian/pool/main/b/bogofilter/bogofilter-bdb_1.2.4+dfsg1-2_i386.deb' bogofilter-bdb_1.2.4+dfsg1-2_i386.deb 145226 MD5Sum:c063ba8de7ddc4192c324f04c092783a
'http://ftp.us.debian.org/debian/pool/main/b/bogofilter/bogofilter_1.2.4+dfsg1-2_all.deb' bogofilter_1.2.4+dfsg1-2_all.deb 1012 MD5Sum:5f1257670b430f96470a361e053d86fb
'http://ftp.us.debian.org/debian/pool/main/e/evolution/evolution-plugins_3.8.5-2+b1_i386.deb' evolution-plugins_3.8.5-2+b1_i386.deb 260382 MD5Sum:bf4efa25dd9a83d931a078a4c61d1c8e

The -d option of apt-get only downloads a package.

So you can call apt-get -d install <package>.

  • Interesting although in that case it downloads it in the cache. I prefer Seth's answer which downloads the package in the current directory. – Alexis Wilke Jan 14 '14 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.