Product SiteDocumentation Site

6.3. Perintah apt-cache

Perintah apt-cache dapat menampilkan banyak informasi yang tersimpan di basisdata internal APT. Informasi ini semacam singgahan karena dikumpulkan dari daftar sumber yang berbeda di berkas sources.list. Hal ini terjadi selama operasi apt update.
Perintah apt-cache dapat melakukan pencarian paket berbasis kata kunci dengan apt-cache search kata_kunci. Ini juga dapat menampilkan header dari versi paket yang tersedia dengan apt-cache show paket. Perintah ini memberikan deskripsi paket, dependensinya, nama pengelolanya, dll. Perhatikan bahwa apt search, apt show, aptitude search, dan aptitude show bekerja dengan cara yang sama.
Beberapa fitur lebih jarang digunakan. Misalnya, apt-cache dumpavail menampilkan header dari semua versi yang tersedia dari semua paket. apt-cache pkgnames menampilkan daftar semua paket yang muncul setidaknya sekali dalam singgahan.
Salah satu fitur yang mungkin lebih berguna adalah apt-cache policy, dijelaskan di bagian berikut.

6.3.1. Perintah apt-cache policy

The apt-cache policy command displays the pinning priorities and distribution properties of each package source as explained in Bagian 6.2.5, “Mengelola Prioritas Paket”. It can also show the pinning priorities for all available versions and sources of a package. For the sources.list example used in Contoh 6.2, “Berkas /etc/apt/sources.list untuk pengguna Debian Stable” and APT::Default-Release set to "/^bookworm(|-security|-updates)$/", the output will look like this:
$ apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 990 http://deb.debian.org/debian bookworm-updates/non-free-firmware amd64 Packages
     release v=12-updates,o=Debian,a=stable-updates,n=bookworm-updates,l=Debian,c=non-free-firmware,b=amd64
     origin deb.debian.org
 990 http://deb.debian.org/debian bookworm-updates/main amd64 Packages
     release v=12-updates,o=Debian,a=stable-updates,n=bookworm-updates,l=Debian,c=main,b=amd64
     origin deb.debian.org
 990 http://security.debian.org/debian-security bookworm-security/non-free-firmware amd64 Packages
     release v=12,o=Debian,a=stable-security,n=bookworm-security,l=Debian-Security,c=non-free-firmware,b=amd64
     origin security.debian.org
 990 http://security.debian.org/debian-security bookworm-security/main amd64 Packages
     release v=12,o=Debian,a=stable-security,n=bookworm-security,l=Debian-Security,c=main,b=amd64
     origin security.debian.org
 990 http://deb.debian.org/debian bookworm/non-free-firmware amd64 Packages
     release v=12.5,o=Debian,a=stable,n=bookworm,l=Debian,c=non-free-firmware,b=amd64
     origin deb.debian.org
 990 http://deb.debian.org/debian bookworm/main amd64 Packages
     release v=12.5,o=Debian,a=stable,n=bookworm,l=Debian,c=main,b=amd64
     origin deb.debian.org
Pinned packages:
apt-cache policy juga dapat menunjukkan prioritas pin untuk semua versi dan sumber paket tertentu yang tersedia.
$ apt-cache policy adb
adb:
  Installed: 1:29.0.6-28
  Candidate: 1:29.0.6-28
  Version table:
     1:33.0.3-2~bpo12+1 100
        100 http://deb.debian.org/debian bookworm-backports/main amd64 Packages
 *** 1:29.0.6-28 990
        990 http://deb.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status
Although there is a newer version of adb in the bookworm-backports repository, APT will not install it automatically based on the priority. One would have to use apt install adb/bookworm-backports or add a higher pinning priority to /etc/apt/preferences.d/adb.pref:
Package: adb
Pin: release o=Debian Backports,n=bookworm-backports
Pin-Priority: 1001
$ apt-cache policy limnoria
adb:
  Installed: 1:29.0.6-28
  Candidate: 1:33.0.3-2~bpo12+1
  Version table:
     1:33.0.3-2~bpo12+1 1001
        100 http://deb.debian.org/debian bookworm-backports/main amd64 Packages
 *** 1:29.0.6-28 990
        990 http://deb.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status