I am often interested in the installation triggers (postinst, postrm) or certain parts of packages (like /usr/share
and /etc
). Currently, I am running the next command to retrieve the source code:
apt-get source [package-name]
The downside is, this file is often much bigger than the binary package and does not reflect the installation tree.
Right now, I am downloading the packages through http://packages.ubuntu.com/:
- Search for
[package-name]
- Select the package
- Click on amd64/i386 for download
- Download the actual file
This takes too long for me and as someone who really likes the shell, I would like to do something like the next (imaginary) command:
apt-get get-deb-file [package-name]
I could not find something like this in the apt-get manual page. The most close I found was the --download-only
switch, but this puts the package in /var/cache/apt/archives
(which requires root permissions) and not in the current directory.
Best Answer
You can use the
download
sub-command ofapt
,apt-get
oraptitude
. For example, if $PKG is the package you want, any of these will do:This doesn't require root privileges. The same can also be approximated using
apt-get
andwget
:This will, however, fetch all packages required to install the package, so you can attempt to limit it instead:
You can also put a wget line into a function, to be able to use it as a command apt-download with the package name as a parameter:
Note the modifications: The $PKG is replaced with $1 and the -c parameter enables continuing interrupted downloads.