有没有办法在不先下载包的情况下使用 apt-get 显示包内容?

有没有办法在不先下载包的情况下使用 apt-get 显示包内容?

我知道我可以使用以下命令列出包中的文件,该命令首先将包(.deb)下载到/var/cache/apt/archives然后列出其内容:

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

是否apt-get支持在不先下载软件包的情况下列出软件包内容的任何方式?

额外的:此外,如何下载apt-get --download-only ...不包含所有依赖项的包?

答案1

我认为这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.

相关内容