Is it possible to list available packages in a specific repository, one of the repositories configured in apt, on Debian Jessie using the command line?

For example,

deb http://ftp.de.debian.org/debian jessie main non-free

from /etc/apt/sources.list.

  • try apt-cache command
    – Ijaz Ahmad
    Apr 15 '16 at 9:57

Given that the repository you're interested in is in your apt sources, you can find the information on the packages available there in the files apt downloads; for the line

deb http://ftp.de.debian.org/debian jessie main non-free

these would be respectively

  • /var/lib/apt/lists/ftp.de.debian.org_debian_dists_jessie_main_binary-amd64_Packages
  • /var/lib/apt/lists/ftp.de.debian.org_debian_dists_jessie_non-free_binary-amd64_Packages

(assuming you're on amd64). You can ensure those files are up-to-date first by running

apt-get update

Aptitude can search by archive name:

aptitude search '~Ajessie'

~Aarchive (or, equivalently ?archive(archive)) is documented in the search term reference as

Select packages from the given archive (such as “unstable”).

If you want only the package names, then pass -F %p to format the output appropriately; by default you'll also get status and short description for each package.



wget http://ftp.de.debian.org/debian/dists/jessie/main/binary-amd64/Packages.gz -O jessie.main.binary-amd64.Packages.gz

wget http://ftp.de.debian.org/debian/dists/jessie/non-free/binary-amd64/Packages.gz -O jessie.non-free.binary-amd64.Packages.gz

Followed by

gunzip jessie.main.binary-amd64.Packages.gz jessie.non-free.binary-amd64.Packages.gz

This will give you two files called jessie.main.binary-amd64.Packages and jessie.non-free.binary-amd64.Packages, which will jointly contain a list of packages corresponding to the source line

deb http://ftp.de.debian.org/debian jessie main non-free

As Stephen noted, if the sources entry is in your sources.list, then these files, along with many others, will be automatically downloaded to your disk, along with many others.

  • If apt-get update has been run after adding the source line, you might be able to use the existing files in /var/lib/apt/lists.
    – muru
    Apr 15 '16 at 10:03

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.