如何列出 Debian 软件包中包含的所有文件

假设您正在尝试安装特定的 deb 包,但想在实际安装之前了解该包中包含哪些文件。或者想象一下,您不确定哪个包拥有您需要的特定程序二进制文件或库。

在这些情况下,如果您可以在安装前检查特定 deb 包的内容,将会很有用。这篇文章告诉你如何去做。

在 Ubuntu 或 Debian 中,有两种方法可以在不安装特定 deb 包的情况下显示包含在特定 deb 包中的所有文件。

方法一: apt-file

第一种方法是使用apt-file命令行工具。

apt-file在 Ubuntu 或 Debian 上安装和使用,请执行以下操作。

$ sudo apt-get install apt-file
$ sudo apt-file update

请注意,您首先需要运行“ apt-file update”,以便从其来源同步所有可用的包内容。

然后要显示属于特定 deb 包(例如,tofrodos)的文件,只需运行:

$ sudo apt-file show tofrodos
tofrodos:/usr/bin/fromdos
tofrodos: /usr/bin/todos
tofrodos: /usr/share/doc/tofrodos/NEWS.Debian.gz
tofrodos: /usr/share/doc/tofrodos/changelog.Debian.gz
tofrodos:/usr/share/doc/tofrodos/copyright
tofrodos:/usr/share/doc/tofrodos/readme.txt.gz
tofrodos:/usr/share/doc/tofrodos/tofrodos.html
tofrodos:/usr/share/man/man1/fromdos.1.gz
tofrodos:/usr/share/man/man1/todos.1.gz

输出将显示所有包含文件的名称,以及它们各自的目标安装目录。

方法二: apt-get

显示 Debian 软件包中文件的第二种方法是使用apt-get命令,但带有--download-only选项。

$ apt-get --download-only install tofrodos

运行上述命令后,名为 deb 的软件包tofrodos将下载到/var/cache/apt/archives,但不会安装。

然后你可以使用dpkg命令列出本地下载的 deb 包的内容。

$ dpkg -c /var/cache/apt/archives/tofrodos_1.7.9.debian.1-1build1_amd64.deb
drwxr-xr-x root/root         0 2011-10-18 10:47 ./
drwxr-xr-x root/root         0 2011-10-18 10:47 ./usr/
drwxr-xr-x root/root         0 2011-10-18 10:47 ./usr/share/
drwxr-xr-x root/root         0 2011-10-18 10:47 ./usr/share/man/
drwxr-xr-x root/root         0 2011-10-18 10:47 ./usr/share/man/man1/
-rw-r--r-- root/root      1677 2011-10-18 10:47 ./usr/share/man/man1/fromdos.1.gz
drwxr-xr-x root/root         0 2011-10-18 10:47 ./usr/share/doc/
drwxr-xr-x root/root         0 2011-10-18 10:47 ./usr/share/doc/tofrodos/
-rw-r--r-- root/root       391 2011-10-18 10:47 ./usr/share/doc/tofrodos/NEWS.Debian.gz
-rw-r--r-- root/root      1406 2011-10-18 10:47 ./usr/share/doc/tofrodos/copyright
-rw-r--r-- root/root      5832 2011-02-27 04:25 ./usr/share/doc/tofrodos/tofrodos.html
-rw-r--r-- root/root      3746 2011-10-18 10:47 ./usr/share/doc/tofrodos/changelog.Debian.gz
-rw-r--r-- root/root      5410 2011-02-27 04:25 ./usr/share/doc/tofrodos/readme.txt.gz
drwxr-xr-x root/root         0 2011-10-18 10:47 ./usr/bin/
-rwxr-xr-x root/root     12792 2011-10-18 10:47 ./usr/bin/fromdos
lrwxrwxrwx root/root         0 2011-10-18 10:47 ./usr/share/man/man1/todos.1.gz -> fromdos.1.gz
lrwxrwxrwx root/root         0 2011-10-18 10:47 ./usr/bin/todos -> fromdos
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值