当前位置: 首页 > news >正文

[技巧] 如何查看Debian/Ubuntu软件包.deb的内容

为什么80%的码农都做不了架构师?>>>   hot3.png

在Redhat系Linux版本(CentOS/Fedora/RHEL)下,我们想要查看rpm包的内容,直接使用 rpm -ql packagename 命令就可以了,那么在Debian/Ubuntu Linux下又如何查看.deb软件包的内容呢?

系统默认安装的软件和命令无法查看,这时候我们需要安装 apt-file 命令工具,该命令可以查看使用APT作为软件包管理器的系统deb文件的内容。

安装apt-file
  1. #apt-get update && apt-get install apt-file
安装过程中,将会看到类似下面的输出信息:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libapt-pkg-perl libconfig-file-perl liblist-moreutils-perl menu
Suggested packages:
  gksu kdebase-bin kdebase-runtime ktsuss sux
The following NEW packages will be installed:
  apt-file libapt-pkg-perl libconfig-file-perl liblist-moreutils-perl menu
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 626kB of archives.
After this operation, 2687kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.kernel.org lenny/main libconfig-file-perl 1.42-1 [11.7kB]
Get:2 http://mirrors.kernel.org lenny/main libapt-pkg-perl 0.1.22+b1 [89.6kB]
Get:3 http://mirrors.kernel.org lenny/main liblist-moreutils-perl 0.22-1+b1 [51.9kB]
Get:4 http://mirrors.kernel.org lenny/main apt-file 2.1.5 [19.2kB]
Get:5 http://mirrors.kernel.org lenny/main menu 2.1.41 [453kB]
Fetched 626kB in 9s (67.3kB/s)
Selecting previously deselected package libconfig-file-perl.
(Reading database ... 21061 files and directories currently installed.)
Unpacking libconfig-file-perl (from .../libconfig-file-perl_1.42-1_all.deb) ...
Selecting previously deselected package libapt-pkg-perl.
Unpacking libapt-pkg-perl (from .../libapt-pkg-perl_0.1.22+b1_amd64.deb) ...
Selecting previously deselected package liblist-moreutils-perl.
Unpacking liblist-moreutils-perl (from .../liblist-moreutils-perl_0.22-1+b1_amd64.deb) ...
Selecting previously deselected package apt-file.
Unpacking apt-file (from .../apt-file_2.1.5_all.deb) ...
Selecting previously deselected package menu.
Unpacking menu (from .../archives/menu_2.1.41_amd64.deb) ...
Processing triggers for man-db ...
Setting up libconfig-file-perl (1.42-1) ...
Setting up libapt-pkg-perl (0.1.22+b1) ...
Setting up liblist-moreutils-perl (0.22-1+b1) ...
Setting up apt-file (2.1.5) ...
You need to run 'apt-file update' as root to update the cache.
Setting up menu (2.1.41) ...
Processing triggers for menu ...

这样就安装成功了,不过,在使用apt-file查看deb包内容前,我们首先得重新同步一下软件包内容。
  1. #apt-file update
列出Debian下.deb文件或软件包的内容

命令格式如下:
  1. #apt-file list packageName
下面我们以wget为例,来看看其中包含的文件列表:
  1. #apt-file list wget
输出信息如下:

epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/gwget.xml
epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/libgwgetextension.a
epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/libgwgetextension.la
epiphany-extension-gwget: /usr/lib/epiphany-gecko/2.22/extensions/libgwgetextension.so
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/AUTHORS
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/NEWS.gz
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/README
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/THANKS
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/TODO
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/changelog.Debian.gz
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/changelog.gz
epiphany-extension-gwget: /usr/share/doc/epiphany-extension-gwget/copyright
gwget: /usr/bin/gwget
gwget: /usr/share/applications/gwget.desktop
gwget: /usr/share/dbus-1/services/gwget.service
gwget: /usr/share/doc/gwget/AUTHORS
gwget: /usr/share/doc/gwget/NEWS.Debian.gz
.....
......
wget-el: /usr/share/emacs/site-lisp/wget-el/wget-sysdep.el
wget-el: /usr/share/emacs/site-lisp/wget-el/wget.el

另一个例子,查看 foo.deb文件的内容:
  1. #dpkg-deb -c foo.deb
  2. #dpkg-deb -c acct_6.4~pre1-6_amd64.deb
输入信息如下:

drwxr-xr-x root/root         0 2008-03-08 14:26 ./
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/init.d/
-rwxr-xr-x root/root      1787 2008-03-08 14:26 ./etc/init.d/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/default/
-rw-r--r-- root/root       332 2008-03-08 14:26 ./etc/default/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/cron.monthly/
-rwxr-xr-x root/root      1281 2008-03-08 14:26 ./etc/cron.monthly/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./etc/cron.daily/
-rwxr-xr-x root/root       379 2008-03-08 14:26 ./etc/cron.daily/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/sbin/
-rwxr-xr-x root/root     11000 2008-03-08 14:26 ./usr/sbin/dump-utmp
-rwxr-xr-x root/root     12760 2008-03-08 14:26 ./usr/sbin/dump-acct
-rwxr-xr-x root/root     29240 2008-03-08 14:26 ./usr/sbin/sa
-rwxr-xr-x root/root      8184 2008-03-08 14:26 ./usr/sbin/accton
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/bin/
-rwxr-xr-x root/root     21592 2008-03-08 14:26 ./usr/bin/ac
-rwxr-xr-x root/root     20888 2008-03-08 14:26 ./usr/bin/lastcomm
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/doc-base/
-rw-r--r-- root/root       587 2008-03-08 14:26 ./usr/share/doc-base/acct
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/doc/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/doc/acct/
-rw-r--r-- root/root      3994 2003-06-05 22:27 ./usr/share/doc/acct/README
-rw-r--r-- root/root      1247 2008-03-08 14:26 ./usr/share/doc/acct/copyright
-rw-r--r-- root/root     68845 2008-03-08 14:26 ./usr/share/doc/acct/accounting.html
-rw-r--r-- root/root      1601 2006-01-08 04:44 ./usr/share/doc/acct/NEWS.gz
-rw-r--r-- root/root      7105 2008-03-08 14:26 ./usr/share/doc/acct/changelog.Debian.gz
-rw-r--r-- root/root     14612 2006-01-08 04:44 ./usr/share/doc/acct/changelog.gz
-rw-r--r-- root/root      8534 2003-06-05 22:27 ./usr/share/doc/acct/TODO.gz
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/man/
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/man/man1/
-rw-r--r-- root/root      1655 2008-03-08 14:26 ./usr/share/man/man1/lastcomm.1.gz
-rw-r--r-- root/root      2381 2008-03-08 14:26 ./usr/share/man/man1/ac.1.gz
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/man/man8/
-rw-r--r-- root/root      3118 2008-03-08 14:26 ./usr/share/man/man8/sa.8.gz
-rw-r--r-- root/root       728 2008-03-08 14:26 ./usr/share/man/man8/dump-utmp.8.gz
-rw-r--r-- root/root       915 2008-03-08 14:26 ./usr/share/man/man8/dump-acct.8.gz
-rw-r--r-- root/root       553 2008-03-08 14:26 ./usr/share/man/man8/accton.8.gz
drwxr-xr-x root/root         0 2008-03-08 14:26 ./usr/share/info/
-rw-r--r-- root/root     11307 2008-03-08 14:26 ./usr/share/info/accounting.info.gz

如果软件包已经安装了,直接使用dpkg命令就能查看:
  1. #dpkg -L packageName
转载请注明出处: http://club.topsage.com/thread-2208923-1-1.html

转载于:https://my.oschina.net/qihh/blog/61418

相关文章:

  • PrestaShop支付接口-网银在线支付,在线支付收款,外贸收款
  • 嵌入式第一课:嵌入式系统概述
  • Thrift之TProtocol类体系原理及源码详细解析之JSon协议类TJSONProtocol
  • 分享几个经典实用的shell命令
  • MYSQL5.5半同步复制介绍
  • Hello, WebView
  • Tomcat的JVM设置和连接数设置
  • 【J2me 2D 游戏开发系列】Himi游戏开发J零基础学习历程
  • Dynamo: Amazon’s Highly Available Key-value Store
  • 在网络设备上调试 Android 程序
  • 开发工程师未来应具备的能力
  • 路由协议和被路由协议
  • 接口的显示实现和隐式实现
  • 通过 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase 实现 WPF 单例启动
  • 第八章 图形编程 笔记
  • [微信小程序] 使用ES6特性Class后出现编译异常
  • Flannel解读
  • leetcode讲解--894. All Possible Full Binary Trees
  • open-falcon 开发笔记(一):从零开始搭建虚拟服务器和监测环境
  • Phpstorm怎样批量删除空行?
  • python_bomb----数据类型总结
  • Webpack入门之遇到的那些坑,系列示例Demo
  • webpack项目中使用grunt监听文件变动自动打包编译
  • win10下安装mysql5.7
  • 百度小程序遇到的问题
  • 分享自己折腾多时的一套 vue 组件 --we-vue
  • 近期前端发展计划
  • 类orAPI - 收藏集 - 掘金
  • 前端 CSS : 5# 纯 CSS 实现24小时超市
  • 使用parted解决大于2T的磁盘分区
  • 通过npm或yarn自动生成vue组件
  • 小李飞刀:SQL题目刷起来!
  • 通过调用文摘列表API获取文摘
  • #!/usr/bin/python与#!/usr/bin/env python的区别
  • #[Composer学习笔记]Part1:安装composer并通过composer创建一个项目
  • #if和#ifdef区别
  • #控制台大学课堂点名问题_课堂随机点名
  • (007)XHTML文档之标题——h1~h6
  • (27)4.8 习题课
  • (zt)基于Facebook和Flash平台的应用架构解析
  • (安卓)跳转应用市场APP详情页的方式
  • (动手学习深度学习)第13章 计算机视觉---微调
  • (附源码)spring boot基于Java的电影院售票与管理系统毕业设计 011449
  • (附源码)ssm旅游企业财务管理系统 毕业设计 102100
  • (十七)devops持续集成开发——使用jenkins流水线pipeline方式发布一个微服务项目
  • (十一)图像的罗伯特梯度锐化
  • (四)TensorRT | 基于 GPU 端的 Python 推理
  • (五) 一起学 Unix 环境高级编程 (APUE) 之 进程环境
  • (转)EXC_BREAKPOINT僵尸错误
  • (转)IIS6 ASP 0251超过响应缓冲区限制错误的解决方法
  • .NET 编写一个可以异步等待循环中任何一个部分的 Awaiter
  • .net获取当前url各种属性(文件名、参数、域名 等)的方法
  • /etc/apt/sources.list 和 /etc/apt/sources.list.d
  • @Autowired和@Resource的区别
  • @DataRedisTest测试redis从未如此丝滑