Debian

有沒有辦法在不先下載包的情況下使用 apt-get 顯示包內容?

  • June 5, 2020

我知道我可以使用以下命令列出包中的文件,該命令首先將包(.deb)下載到/var/cache/apt/archives然後列出其內容:

apt-get --download-only install <pkg>
dpkg --contents <pkg> (.deb)

是否apt-get支持在不首先下載包的情況下列出包內容的任何方式?

額外:此外,我如何下載一個apt-get --download-only ...沒有所有依賴項的包?

我不認為那apt-get可以做到,不,但apt-file可以:

sudo apt install apt-file
sudo apt update

接著:

sudo apt-file list <pkg>

例如:

$ sudo apt-file list xterm
xterm: /etc/X11/app-defaults/KOI8RXTerm
xterm: /etc/X11/app-defaults/KOI8RXTerm-color
xterm: /etc/X11/app-defaults/UXTerm
xterm: /etc/X11/app-defaults/UXTerm-color
xterm: /etc/X11/app-defaults/XTerm
xterm: /etc/X11/app-defaults/XTerm-color
xterm: /usr/bin/koi8rxterm
xterm: /usr/bin/lxterm
xterm: /usr/bin/resize
xterm: /usr/bin/uxterm
xterm: /usr/bin/xterm
xterm: /usr/share/applications/debian-uxterm.desktop
xterm: /usr/share/applications/debian-xterm.desktop
xterm: /usr/share/doc-base/xterm-ctlseqs
xterm: /usr/share/doc-base/xterm-faq
xterm: /usr/share/doc/xterm/NEWS.Debian.gz
xterm: /usr/share/doc/xterm/README.Debian
xterm: /usr/share/doc/xterm/README.i18n.gz
xterm: /usr/share/doc/xterm/changelog.Debian.gz
xterm: /usr/share/doc/xterm/copyright
xterm: /usr/share/doc/xterm/ctlseqs.ms.gz
xterm: /usr/share/doc/xterm/ctlseqs.txt.gz
xterm: /usr/share/doc/xterm/xterm.faq.gz
xterm: /usr/share/doc/xterm/xterm.faq.html
xterm: /usr/share/doc/xterm/xterm.log.html
xterm: /usr/share/doc/xterm/xterm.termcap.gz
xterm: /usr/share/doc/xterm/xterm.terminfo.gz
xterm: /usr/share/icons/hicolor/48x48/apps/xterm-color.png
xterm: /usr/share/icons/hicolor/scalable/apps/xterm-color.svg
xterm: /usr/share/man/man1/koi8rxterm.1.gz
xterm: /usr/share/man/man1/lxterm.1.gz
xterm: /usr/share/man/man1/resize.1.gz
xterm: /usr/share/man/man1/uxterm.1.gz
xterm: /usr/share/man/man1/xterm.1.gz
xterm: /usr/share/pixmaps/filled-xterm_32x32.xpm
xterm: /usr/share/pixmaps/filled-xterm_48x48.xpm
xterm: /usr/share/pixmaps/mini.xterm_32x32.xpm
xterm: /usr/share/pixmaps/mini.xterm_48x48.xpm
xterm: /usr/share/pixmaps/xterm-color_32x32.xpm
xterm: /usr/share/pixmaps/xterm-color_48x48.xpm
xterm: /usr/share/pixmaps/xterm_32x32.xpm
xterm: /usr/share/pixmaps/xterm_48x48.xpm

至於下載,這就是download命令的用途:

apt-get download <pkg>

man apt-get

  download
      download will download the given binary package into the current
      directory.

引用自:https://unix.stackexchange.com/questions/591104