Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Apt (Advanced Packaging Tool) has option to download only package by apt-get -d install [pkg-name]. I have also find apt-get download [pkg-name] to download packages.

Then what is the difference between --download-only (apt-get -d install)and download (apt-get download)?

And When should I use between them?

share|improve this question
up vote 10 down vote accepted

I could list following:

1) Try both without sudo, apt-get download will pass and apt-get -d install will fail (root required)

2) By default apt-get -d install will save .deb in /var/cache/apt/archives and apt-get download in current directory

3) apt-get download is newer, you wouldn't even find it in the old versions.

I hope they are helpful

share|improve this answer
Have a look at man apt-get. – cinelli May 9 '14 at 16:16

The --download-only switch needs to be accompanied by another command, be it install, upgrade or whatever command would require to download package. If you don't need to download packages, is plain as day that it wouldn't download anything. --download-only restricts apt actions to just downloading the packages that it needs into the cache directory, nothing more. If your operation would end into downloading dependencies it will download them for you.

Since it needs a command like install or upgrade it normally would require sudo or root permissions, since the default directory used to download the packages is owned by root.

The download command is standalone, it reads the package list and download only the package specified, it doesn't download dependencies nor other packages. It doesn't require root permissions if you can write your current directory, this wouldn't store the files in the package cache directory.

share|improve this answer

Use the man command :)

apt-get download will download the package to the current directory.

apt-get -d install will download the given packages to the system packages directory (/var/cache/apt/archives).

Use the first if you want to download a .deb to then tinker with it (uncompress it, poke at it with dpkg, whatever).

Use the second if you want to "pre-download" a set of packages for later installation.

share|improve this answer

See the manual page for apt-get.

-d, --download-only
    Download only; package files are only retrieved, not unpacked or installed. 

The 2 options are the same and do identical actions. So you can use either one.

In general: most times options come in 2 forms: short and long. From apt-get you can also use -f, --fix-broken or -m, --ignore-missing, --fix-missing or -q, --quiet. All of these groups mean the same and will do the same.

Some people prefer long options. Some prefer short options. In software languages (like Python) you have a method where you can split option + value into an array. And it then also will have a method to define sets of options for short and long version. So it is possible to satisfy everyone's need for options :)

apt-get download was added in version 0.8.11 of apt as another form of -d where the download is done to the current directory.

share|improve this answer
The command download is not the same as the switch --download-only – guntbert May 9 '14 at 13:47
@guntbert yes it is. The only difference is the location where it is saved. The option and command do the same: download. If you cd to the cache dir and do a download how does that differ from -d? It does not. – Rinzwind May 9 '14 at 13:49
Ahem: that is not the same, it's similar. – guntbert May 9 '14 at 13:52

Your Answer


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.