Is there any way (dpkg, apt?) to get a package's sources and URL to repository, if available, in Debian ?
for latest version:
apt-get download --print-uris package | cut -d' ' -f1
for specific version
apt-get download --print-uris package=version | cut -d' ' -f1
2kept trying this, but no path was printed. Found that having already downloaded the file with
apt-get download pkgit will not print anything. So deleting the file in current wd first worked Apr 26, 2021 at 20:29
apt-cache policy package displays which versions can be installed from which repositories.
bash$ apt-cache policy dpkg dpkg: Installed: 220.127.116.11ubuntu7.1 Candidate: 18.104.22.168ubuntu7.1 Version table: *** 22.214.171.124ubuntu7.1 0 500 http://fi.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages 500 http://mirrors.nic.funet.fi/ubuntu/ precise-updates/main amd64 Packages 100 /var/lib/dpkg/status 126.96.36.199ubuntu7 0 500 http://fi.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
apt-get install --yes --no-download --reinstall --print-uris package-name
You can extract just URL by adding:
| tail -n1 | grep -o "http[^']\+"
does not work for me Feb 27, 2016 at 9:02
Worked for me, thanks. The important part is
--print-urisOct 5, 2017 at 9:55
Doesn't work if the package has unmet deps May 17, 2018 at 2:26
On Debian 11 not works.
$ sudo apt install --yes --no-download --reinstall --print-uris vim Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?– EsmaeelEJun 5, 2022 at 2:33
To get the source:
Check that you have a
deb-src line in
As root, run
apt-get build-dep package.
As normal user, run
apt-get source package.
To get the URL, go to
Then you get a list of the different versions in the supported archives.
If the source package name differs from the binary, it's in the package description, 2nd line it seems.
grep -A1 binpackagename /var/lib/apt/*Packages |grep Source should do the trick.
sudo apt-get source packageName? It installs the newest available source tree, when available, in the current working directory.
man apt-get for more details.
1I need just the name. Is there a way to get it ? Also, how could I get the git repo URL from where it downloads the package ? Jan 16, 2013 at 19:47
4No real need for
sudohere, right?– sr_Jan 16, 2013 at 21:15
You can use website pkgs.org where you can search for packages. It will give you package and repository path as well.
You can use a very simple script called
apt-url, that uses
apt-move behind the scene to show the package URL.
This script could be found at:
I wonder why nobody suggests
apt show <package-name>.
$ apt show docker-compose Package: docker-compose Version: 1.21.0-3 Priority: optional Section: admin Maintainer: Docker Compose Team <email@example.com> Installed-Size: 632 kB Depends: python3-cached-property (>= 1.2.0), python3-docker (>= 3.2.1), python3-dockerpty (>= 0.4.1), python3-docopt (>= 0.6.1), python3-jsonschema, python3-requests (>= 2.6.1), python3-six (<< 2), python3-six (>= 1.3.0), python3-texttable (>= 0.9.0), python3-websocket (>= 0.32.0), python3-yaml (>= 3.10), python3:any (>= 3.6~), python3-distutils Recommends: docker.io (>= 1.9.0) Homepage: http://docs.docker.com/compose/ Download-Size: 108 kB APT-Manual-Installed: yes APT-Sources: http://deb.debian.org/debian buster/main amd64 Packages Description: Punctual, lightweight development environments using Docker docker-compose is a service management software built on top of docker. Define your services and their relationships in a simple YAML file, and let compose handle the rest.