本文简介及包格式部分内容节选自:

deb_百度百科

一、简介

DEB是Debian软件包格式的文件扩展名,跟Debian的命名一样,DEB也是因Debra Murdock而得名,她是Debian创始人Ian Murdock的太太。

Debian包是Unixar的标准归档,在Linux操作系统中类似于windows中的软件包(msi),几乎不需要什么复杂的编译即可通过鼠标点击安装使用。

二、包格式

deb包本身由三部分组成:数据包,包含实际安装的程序数据,文件名为data.tar.XXX安装信息及控制脚本包,包含deb的安装说明、标识、脚本等,文件名为control.tar.gzdeb文件的一些二进制数据,包括文件头等信息,一般看不到,在某些软件中打开可以看到。

三、deb包解压实例

在此我们以flameshot的deb包为例,下载并进行解压,看一下包的实际内容,对照上边包格式以加深理解。

flameshot是一款堪称完美的截图工具软件。其下载地址为:

Releases · flameshot-org/flameshot · GitHub

这里我们选择其中的flameshot-12.1.0-1.debian-10.amd64.deb 进行下载,并将其放置到某一路径下。

注:电脑环境为Linux环境,具体为Ubuntu22.04。

1. 图形界面下查看

在图形界面下双击下载的flameshot deb包进行查看,如下图所示:

  • control.tar.xz

control.tar.xz就是包格式中提到的安装信息及控制脚本包,包含deb的安装说明、标识、脚本等。继续对于其下内容进行查看。如下图所示:

control文件内容如下:

Package: flameshot
Version: 12.1.0-1
Architecture: amd64
Maintainer: Boyuan Yang <byang@debian.org>
Installed-Size: 3446
Depends: hicolor-icon-theme, libqt5svg5 (>= 5.9.0~), libc6 (>= 2.14), libgcc1 (>= 1:3.0), libqt5core5a (>= 5.11.0~rc1), libqt5dbus5 (>= 5.9.0~), libqt5gui5 (>= 5.10.0), libqt5network5 (>= 5.9.0~), libqt5widgets5 (>= 5.11.0~rc1), libstdc++6 (>= 5.2)
Recommends: xdg-desktop-portal-gtk | xdg-desktop-portal-gnome | xdg-desktop-portal-kde | xdg-desktop-portal-wlr, grim
Suggests: ca-certificates, openssl
Section: graphics
Priority: optional
Homepage: https://github.com/flameshot-org/flameshot
Description: Powerful yet simple-to-use screenshot softwareFlameshot is a powerful yet simple-to-use screenshot software.Notable features include customizable appearance, in-app screenshot editing,D-Bus interface, experimental GNOME/KDE Wayland support, integration withImgur and support for both GUI and CLI interface.

md5sums文件内容如下:

45e6d0f9a26a94f6d46bf5216a78ed6d  usr/bin/flameshot
3bb45b56a64a49e5d1a144365d377b28  usr/share/applications/org.flameshot.Flameshot.desktop
935c5b63477520e5c1e130ff36f1e8fd  usr/share/bash-completion/completions/flameshot
b76ee25c1c4dee15d268f69f726b73c4  usr/share/dbus-1/interfaces/org.flameshot.Flameshot.xml
1a2c55c59c3ce0f6dee105ed956e7e81  usr/share/dbus-1/services/org.flameshot.Flameshot.service
7b4173376039e21f1efe8105337cab1b  usr/share/doc/flameshot/README.md.gz
a0d7ed6e6d4f6f459c01d58dac7a2ec6  usr/share/doc/flameshot/changelog.Debian.gz
36680faef628d69f6d8aa3d93d2ac21f  usr/share/doc/flameshot/copyright
3d2fc7139bac3fc08255f281950c5b0f  usr/share/fish/vendor_completions.d/flameshot.fish
6e8c7703d529fa936fe18bf55da8faa3  usr/share/flameshot/translations/Internationalization_bg.qm
865a4c4aab34f121087e910a77110d40  usr/share/flameshot/translations/Internationalization_ca.qm
2b1143a5d785b79abcb74dea9f1fb68a  usr/share/flameshot/translations/Internationalization_cs.qm
90bee22531562138061a8ca1fbf72d50  usr/share/flameshot/translations/Internationalization_de_DE.qm
3e58f240a56437609e3c3ece312b926a  usr/share/flameshot/translations/Internationalization_el.qm
c9eb7adfed9c569dae126585fa109678  usr/share/flameshot/translations/Internationalization_es.qm
619fb3b81ed96e03897e3ca30048270b  usr/share/flameshot/translations/Internationalization_eu.qm
8c1218f3a5c5aa3ef2f5bfed8908e1ec  usr/share/flameshot/translations/Internationalization_fa.qm
746ca7f632fdc8a24ad154c8bbe37875  usr/share/flameshot/translations/Internationalization_fi.qm
5c526769dfb6c9d85d47c68d8a3f8cbc  usr/share/flameshot/translations/Internationalization_fr.qm
bffcde1c73833edf70ef0292b79519c2  usr/share/flameshot/translations/Internationalization_gl.qm
5b60c01f0735863a59fd20116d0813df  usr/share/flameshot/translations/Internationalization_grc.qm
6893721001e4b5c239304838ddd5cb06  usr/share/flameshot/translations/Internationalization_he.qm
8aa14e033b069c58efd2d24e33b26f60  usr/share/flameshot/translations/Internationalization_hu.qm
6b7f46e375d7521694c45978f6859988  usr/share/flameshot/translations/Internationalization_id.qm
f75e2794f7d0302855d6ff9cea0c5c66  usr/share/flameshot/translations/Internationalization_it_IT.qm
805711c11210426e528d76b5c0abf4dc  usr/share/flameshot/translations/Internationalization_ja.qm
32dba4921b6d0bdd70131bb3f49b3c34  usr/share/flameshot/translations/Internationalization_ka.qm
3978f3b41d4cffeadde617fb18a5f8aa  usr/share/flameshot/translations/Internationalization_ko.qm
5f8c5d87a50f4acb5b6e2cc60199f7f4  usr/share/flameshot/translations/Internationalization_nb_NO.qm
e2946b485128a2d56614e08198b1dc80  usr/share/flameshot/translations/Internationalization_nl.qm
57c3bccea8ef29fb0dc57dc22409d076  usr/share/flameshot/translations/Internationalization_nl_NL.qm
defc90bc22e13f3f0cca4ff1a18fc531  usr/share/flameshot/translations/Internationalization_pl.qm
578f7426bee89359e263fc6a416d8dab  usr/share/flameshot/translations/Internationalization_pt_BR.qm
62001f6178768a32f7214e6c2ff3c09d  usr/share/flameshot/translations/Internationalization_ru.qm
05a73c032e57a83e66b40953de0fab9b  usr/share/flameshot/translations/Internationalization_sk.qm
b6a9485efa037009ca2637ee21587376  usr/share/flameshot/translations/Internationalization_sr_SP.qm
1b29a570125ac524c2e17ba99a6cacb5  usr/share/flameshot/translations/Internationalization_sv_SE.qm
2a98c23fec878120f1def11a1e224932  usr/share/flameshot/translations/Internationalization_tr.qm
6e9d17a5bbbc5d120e684043e7aeae90  usr/share/flameshot/translations/Internationalization_uk.qm
705466df7b24c9912cb99caf55f7c79f  usr/share/flameshot/translations/Internationalization_vi.qm
d3a220ce53507dca73eeff87a5e57b68  usr/share/flameshot/translations/Internationalization_zh_CN.qm
b2d1a8636251d21307ca81778423e265  usr/share/flameshot/translations/Internationalization_zh_HK.qm
cd7305b5d4310e7a04e16917a50ea588  usr/share/flameshot/translations/Internationalization_zh_TW.qm
6b7fe8a9029eb6eeaf14e0070ee3ea6b  usr/share/icons/hicolor/128x128/apps/flameshot.png
6b7fe8a9029eb6eeaf14e0070ee3ea6b  usr/share/icons/hicolor/128x128/apps/org.flameshot.Flameshot.png
8c6bb754789f9be9c8bb36535deadd0d  usr/share/icons/hicolor/48x48/apps/flameshot.png
8c6bb754789f9be9c8bb36535deadd0d  usr/share/icons/hicolor/48x48/apps/org.flameshot.Flameshot.png
0bdf6bbc223205c3a1b435531dcead49  usr/share/icons/hicolor/scalable/apps/flameshot.svg
0bdf6bbc223205c3a1b435531dcead49  usr/share/icons/hicolor/scalable/apps/org.flameshot.Flameshot.svg
4d238141c42161205107509a82b8ddbe  usr/share/man/man1/flameshot.1.gz
27ded40b0b80815511724889981fcefb  usr/share/metainfo/org.flameshot.Flameshot.metainfo.xml
13722c01bfb4cdb45d576a27f88bb01e  usr/share/zsh/site-functions/_flameshot
  • data.tar.xz

data.tar.xz就是包格式中提到的数据包,包含实际安装的程序数据。继续对于其下内容进行查看。如下图所示:

  • debian-binary

debian-binary就是包格式中提到的deb文件的一些二进制数据,包括文件头等信息。

2. 命令行解压

命令行下有两种方式对deb文件进行解压:dpkg和ar。

(1)方式1 —— dpkg命令

  • 解压出包中的文件

dpkg -x xxx.deb 解压路径

  • 解压出包的控制信息

dpkg -e xxx.deb 解压路径

结合flameshot包我们实际来看一下。进入到flameshot-12.1.0-1.debian-10.amd64.deb的放置路径:

ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test$ cd flameshot/
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls
flameshot-12.1.0-1.debian-10.amd64.deb

在此路径下建立tmp文件夹,tmp文件夹下建立DEBIAN文件夹:

ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ mkdir tmp
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ mkdir tmp/DEBIAN
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls
flameshot-12.1.0-1.debian-10.amd64.deb  tmp
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls tmp/
DEBIAN

将flameshot-12.1.0-1.debian-10.amd64.deb包中的文件解压到tmp/ ,控制信息解压到tmp/DEBIAN/:

ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ dpkg -x flameshot-12.1.0-1.debian-10.amd64.deb tmp/
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls
flameshot-12.1.0-1.debian-10.amd64.deb  tmp
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls tmp
DEBIAN  usr
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls tmp/DEBIAN/
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ dpkg -e flameshot-12.1.0-1.debian-10.amd64.deb tmp/DEBIAN/
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls tmp/DEBIAN/
control  md5sums
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls tmp/DEBIAN/
control  md5sums
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ du tmp/usr/
1780    tmp/usr/bin
32  tmp/usr/share/doc/flameshot
36  tmp/usr/share/doc
8   tmp/usr/share/metainfo
1624    tmp/usr/share/flameshot/translations
1628    tmp/usr/share/flameshot
8   tmp/usr/share/applications
8   tmp/usr/share/dbus-1/interfaces
8   tmp/usr/share/dbus-1/services
20  tmp/usr/share/dbus-1
12  tmp/usr/share/fish/vendor_completions.d
16  tmp/usr/share/fish
12  tmp/usr/share/zsh/site-functions
16  tmp/usr/share/zsh
8   tmp/usr/share/bash-completion/completions
12  tmp/usr/share/bash-completion
8   tmp/usr/share/man/man1
12  tmp/usr/share/man
12  tmp/usr/share/icons/hicolor/48x48/apps
16  tmp/usr/share/icons/hicolor/48x48
20  tmp/usr/share/icons/hicolor/128x128/apps
24  tmp/usr/share/icons/hicolor/128x128
12  tmp/usr/share/icons/hicolor/scalable/apps
16  tmp/usr/share/icons/hicolor/scalable
60  tmp/usr/share/icons/hicolor
64  tmp/usr/share/icons
1824    tmp/usr/share
3608    tmp/usr/

可以看到,与在图形界面下的结果一致,只是控制和数据分别放在了指定路径下,并且没有debian-binary文件。

(2)方式2 —— ar命令

  • 示例

ar -vx xx.deb

以上命令会解压出3个文件:debian-binary,control.tar.xz,data.tar.xz,其中 debian-binary 是一个文本文件,指示.deb软件包格式的版本;control.tar.xz是包含软件包控制信息的压缩包,data.tar .xz包含了所有要从软件包中提取的文件。

ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ar -vx flameshot-12.1.0-1.debian-10.amd64.deb
x - debian-binary
x - control.tar.xz
x - data.tar.xz
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ ls
control.tar.xz  data.tar.xz  debian-binary  flameshot-12.1.0-1.debian-10.amd64.deb  tmp
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ cat debian-binary
2.0

如果要提取包中的文件,把data.tar.xz解压:tar -xvf data.tar.xz。
如果要查看包的控制信息,把control.tar.xz 解压:tar -xvf control.tar.xz。

ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ tar xvf data.tar.xz
./
./usr/
./usr/bin/
./usr/bin/flameshot
./usr/share/
./usr/share/applications/
./usr/share/applications/org.flameshot.Flameshot.desktop
./usr/share/bash-completion/
./usr/share/bash-completion/completions/
./usr/share/bash-completion/completions/flameshot
./usr/share/dbus-1/
./usr/share/dbus-1/interfaces/
./usr/share/dbus-1/interfaces/org.flameshot.Flameshot.xml
./usr/share/dbus-1/services/
./usr/share/dbus-1/services/org.flameshot.Flameshot.service
./usr/share/doc/
./usr/share/doc/flameshot/
./usr/share/doc/flameshot/README.md.gz
./usr/share/doc/flameshot/changelog.Debian.gz
./usr/share/doc/flameshot/copyright
./usr/share/fish/
./usr/share/fish/vendor_completions.d/
./usr/share/fish/vendor_completions.d/flameshot.fish
./usr/share/flameshot/
./usr/share/flameshot/translations/
./usr/share/flameshot/translations/Internationalization_bg.qm
./usr/share/flameshot/translations/Internationalization_ca.qm
./usr/share/flameshot/translations/Internationalization_cs.qm
./usr/share/flameshot/translations/Internationalization_de_DE.qm
./usr/share/flameshot/translations/Internationalization_el.qm
./usr/share/flameshot/translations/Internationalization_es.qm
./usr/share/flameshot/translations/Internationalization_eu.qm
./usr/share/flameshot/translations/Internationalization_fa.qm
./usr/share/flameshot/translations/Internationalization_fi.qm
./usr/share/flameshot/translations/Internationalization_fr.qm
./usr/share/flameshot/translations/Internationalization_gl.qm
./usr/share/flameshot/translations/Internationalization_grc.qm
./usr/share/flameshot/translations/Internationalization_he.qm
./usr/share/flameshot/translations/Internationalization_hu.qm
./usr/share/flameshot/translations/Internationalization_id.qm
./usr/share/flameshot/translations/Internationalization_it_IT.qm
./usr/share/flameshot/translations/Internationalization_ja.qm
./usr/share/flameshot/translations/Internationalization_ka.qm
./usr/share/flameshot/translations/Internationalization_ko.qm
./usr/share/flameshot/translations/Internationalization_nb_NO.qm
./usr/share/flameshot/translations/Internationalization_nl.qm
./usr/share/flameshot/translations/Internationalization_nl_NL.qm
./usr/share/flameshot/translations/Internationalization_pl.qm
./usr/share/flameshot/translations/Internationalization_pt_BR.qm
./usr/share/flameshot/translations/Internationalization_ru.qm
./usr/share/flameshot/translations/Internationalization_sk.qm
./usr/share/flameshot/translations/Internationalization_sr_SP.qm
./usr/share/flameshot/translations/Internationalization_sv_SE.qm
./usr/share/flameshot/translations/Internationalization_tr.qm
./usr/share/flameshot/translations/Internationalization_uk.qm
./usr/share/flameshot/translations/Internationalization_vi.qm
./usr/share/flameshot/translations/Internationalization_zh_CN.qm
./usr/share/flameshot/translations/Internationalization_zh_HK.qm
./usr/share/flameshot/translations/Internationalization_zh_TW.qm
./usr/share/icons/
./usr/share/icons/hicolor/
./usr/share/icons/hicolor/128x128/
./usr/share/icons/hicolor/128x128/apps/
./usr/share/icons/hicolor/128x128/apps/flameshot.png
./usr/share/icons/hicolor/128x128/apps/org.flameshot.Flameshot.png
./usr/share/icons/hicolor/48x48/
./usr/share/icons/hicolor/48x48/apps/
./usr/share/icons/hicolor/48x48/apps/flameshot.png
./usr/share/icons/hicolor/48x48/apps/org.flameshot.Flameshot.png
./usr/share/icons/hicolor/scalable/
./usr/share/icons/hicolor/scalable/apps/
./usr/share/icons/hicolor/scalable/apps/flameshot.svg
./usr/share/icons/hicolor/scalable/apps/org.flameshot.Flameshot.svg
./usr/share/man/
./usr/share/man/man1/
./usr/share/man/man1/flameshot.1.gz
./usr/share/metainfo/
./usr/share/metainfo/org.flameshot.Flameshot.metainfo.xml
./usr/share/zsh/
./usr/share/zsh/site-functions/
./usr/share/zsh/site-functions/_flameshot
ph@ph-ThinkBook-14-G2-ITL:~/dingdao/test/flameshot$ tar xvf control.tar.xz
./
./control
./md5sums

可以看出,ar命令与图形界面下的命令更为接近、甚至一致。

deb包格式实例详解相关推荐

  1. Ubuntu16.04下制作deb包的方法详解

    CSDN GitHub Ubuntu下制作deb包的方法详解 AderXCoding/system/tools/build_deb 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可 ...

  2. android 录音的格式,Android录音mp3格式实例详解

    Android录音支持的格式有amr.aac,但这两种音频格式在跨平台上表现并不好. MP3显然才是跨平台的最佳选择. 项目地址 实现思路概述 在分析代码前,我们需要明确几个问题 1. 如何最终生成M ...

  3. php 显示要上传的图片格式,php判断文件上传图片格式的实例详解

    php判断文件上传图片格式的实例详解 判断文件图片类型, $type = $_FILES['image']['tmp_name'];//文件名 //$type = $this->getImage ...

  4. python爬虫beautifulsoup爬当当网_Python爬虫包 BeautifulSoup 递归抓取实例详解_python_脚本之家...

    Python爬虫包 BeautifulSoup  递归抓取实例详解 概要: 爬虫的主要目的就是为了沿着网络抓取需要的内容.它们的本质是一种递归的过程.它们首先需要获得网页的内容,然后分析页面内容并找到 ...

  5. Python爬虫包 BeautifulSoup 递归抓取实例详解

    Python爬虫包 BeautifulSoup 递归抓取实例详解 概要: 爬虫的主要目的就是为了沿着网络抓取需要的内容.它们的本质是一种递归的过程.它们首先需要获得网页的内容,然后分析页面内容并找到另 ...

  6. java ant解压缩_java ant包中的org.apache.tools.zip实现压缩和解压缩实例详解

    java ant包中的org.apache.tools.zip实现压缩和解压缩实例详解 发布于 2020-4-7| 复制链接 摘记: java ant包中的org.apache.tools.zip实现 ...

  7. 计算机配置参数格式错误,关于bios标准设置故障的实例详解

    以下是学习啦小编为你整理的bios标准设置故障实例详解,供大家参考和学习. 1.电脑的系统时间不准 [故障现象]一台使用了较长时间的兼容机,每次启动后系统的时间都是从1998年1月1日开始让时 [故障 ...

  8. android怎么把动图变成视频格式,Android 录制手机屏幕视频生成GIF图片实例详解

    Android 录制手机屏幕视频生成GIF图片实例详解 无图无真相,在我们日常的网络交流中往往需要给交流对象提供直观的显示,而视频是一个很好的方式,但是视频需要播放器,还需要当做文件进行对点传输,并不 ...

  9. java写exe程序实例,java实现可安装的exe程序实例详解

    java实现可安装的exe程序实例详解 通过编写java代码,实现可安装的exe文件的一般思路: 1.在eclipse中创建java项目,然后编写java代码,将编写好的java项目导出一个.jar格 ...

最新文章

  1. Java的Exception和Error面试题10问10答
  2. 3.7python怎么安装清屏_python3.7中怎么清屏
  3. 最大权闭合子图(最小割)
  4. Android 编程下 px - dp 的相互转换
  5. RabbitMQ消息手动应答生产者
  6. CMDB功能分析与实现方案
  7. Java程序员的推荐阅读书籍
  8. gettid()和pthread_self()的区别
  9. socket编程持续交流java_socket编程的简单问题
  10. 此电脑怎么放在桌面上_电脑内部与麦克风的声音怎么同时录制?详细教程在此...
  11. 深度学习自学(三):NMS非极大值抑制总结
  12. 高质量程序设计指南C++/C试题
  13. word毕业论文页眉设置自动添加章节标题并左右对齐
  14. 电脑常见问题:能打开QQ但不能打开网页(DNS问题)
  15. ios 系统状态栏样式修改_iOS 导航栏颜色和状态栏颜色修改
  16. PS2018 cc的下载和安装
  17. Sleepy Cow Sorting(树状数组)
  18. Unity UI拉伸缩放适配屏幕尺寸
  19. Oracle语句(持续更新)
  20. 用c打印26个小写字母

热门文章

  1. 美团149道面试题,全会拿40Koffer没问题(Java程序员学习方向
  2. 安卓 时间服务器_DNF手游苹果服务器开放预约,预约礼包开放领取,12月份首发...
  3. bios设置raid启动模式Linux,教程:BIOS中如何打开RAID模式
  4. 科技赋能公益,看掌门1对1“灯塔计划”下的教育新火花
  5. 论文伪代码规范,伪代码在线编辑器,
  6. pb 创建动态二维数组
  7. 单位饭局领导很多如何敬酒?套用3种话术足够了,会来事受重用
  8. oracle 数据保留两位小数(祥解ROUND()TRUNC(),TO_CHAR( number, ‘格式’ )函数)
  9. 【The Linux Command Line】学习笔记
  10. 企业邮箱发的“工资补贴”假邮件,又来了