献给 Debian 和 Ubuntu 用户的一组实用程序

献给 Debian 和 Ubuntu 用户的一组实用程序

你使用的是基于 Debian 的系统吗?如果是,太好了!我今天在这里给你带来了一个好消息。先向 “Debian-goodies” 打个招呼,这是一组基于 Debian 系统(比如:Ubuntu、Linux Mint)的有用工具。这些实用工具提供了一些额外的有用的命令,这些命令在基于 Debian 的系统中默认不可用。通过使用这些工具,用户可以找到哪些程序占用更多磁盘空间,更新系统后需要重新启动哪些服务,在一个软件包中搜索与模式匹配的文件,根据搜索字符串列出已安装的包等等。在这个简短的指南中,我们将讨论一些有用的 Debian 的好东西。

Debian-goodies – 给 Debian 和 Ubuntu 用户的实用程序

debian-goodies 包可以在 Debian 和其衍生的 Ubuntu 以及其它 Ubuntu 变体(如 Linux Mint)的官方仓库中找到。要安装 debian-goodies,只需简单运行:

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="kwd">apt-get</span><span class="pln"> install debian</span><span class="pun">-</span><span class="pln">goodies</span>

debian-goodies 安装完成后,让我们继续看一看一些有用的实用程序。

 

1、 checkrestart

让我从我最喜欢的 checkrestart 实用程序开始。安装某些安全更新时,某些正在运行的应用程序可能仍然会使用旧库。要彻底应用安全更新,你需要查找并重新启动所有这些更新。这就是 checkrestart 派上用场的地方。该实用程序将查找哪些进程仍在使用旧版本的库,然后,你可以重新启动服务。

在进行库更新后,要检查哪些守护进程应该被重新启动,运行:

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="pln"> checkrestart</span>
  2. <span class="pun">[</span><span class="kwd">sudo</span><span class="pun">]</span><span class="pln"> password </span><span class="kwd">for</span><span class="pln"> sk</span><span class="pun">:</span>
  3. <span class="typ">Found</span><span class="lit">0</span><span class="pln"> processes </span><span class="kwd">using</span><span class="pln"> old versions of upgraded files</span>

由于我最近没有执行任何安全更新,因此没有显示任何内容。

请注意,checkrestart 实用程序确实运行良好。但是,有一个名为 needrestart 的类似的新工具可用于最新的 Debian 系统。needrestart 的灵感来自 checkrestart 实用程序,它完成了同样的工作。 needrestart 得到了积极维护,并支持容器(LXC、 Docker)等新技术。

以下是 needrestart 的特点:

  • 支持(但不要求)systemd
  • 二进制程序的黑名单(例如:用于图形显示的显示管理器)
  • 尝试检测挂起的内核升级
  • 尝试检测基于解释器的守护进程所需的重启(支持 Perl、Python、Ruby)
  • 使用钩子完全集成到 apt/dpkg 中

它在默认仓库中也可以使用。所以,你可以使用如下命令安装它:

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="kwd">apt-get</span><span class="pln"> install needrestart</span>

现在,你可以使用以下命令检查更新系统后需要重新启动的守护程序列表:

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="pln"> needrestart</span>
  2. <span class="typ">Scanning</span><span class="pln"> processes</span><span class="pun">...</span>
  3. <span class="typ">Scanning</span><span class="pln"> linux images</span><span class="pun">...</span>
  4. <span class="typ">Running</span><span class="pln"> kernel seems to be up</span><span class="pun">-</span><span class="pln">to</span><span class="pun">-</span><span class="kwd">date</span><span class="pun">.</span>
  5. <span class="typ">Failed</span><span class="pln"> to check </span><span class="kwd">for</span><span class="pln"> processor microcode upgrades</span><span class="pun">.</span>
  6. <span class="typ">No</span><span class="pln"> services need to be restarted</span><span class="pun">.</span>
  7. <span class="typ">No</span><span class="pln"> containers need to be restarted</span><span class="pun">.</span>
  8. <span class="typ">No</span><span class="pln"> user sessions are running outdated binaries</span><span class="pun">.</span>

好消息是 Needrestart 同样也适用于其它 Linux 发行版。例如,你可以从 Arch Linux 及其衍生版的 AUR 或者其它任何 AUR 帮助程序来安装,就像下面这样:

  1. <span class="pln">$ yaourt </span><span class="pun">-</span><span class="pln">S needrestart</span>

在 Fedora:

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="pln"> dnf install needrestart</span>

 

2、 check-enhancements

check-enhancements 实用程序用于查找那些用于增强已安装的包的软件包。此实用程序将列出增强其它包但不是必须运行它的包。你可以通过 -ip–installed-packages 选项来查找增强单个包或所有已安装包的软件包。

例如,我将列出增强 gimp 包功能的包:

  1. <span class="pln">$ check</span><span class="pun">-</span><span class="pln">enhancements gimp</span>
  2. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">data</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">22</span><span class="pun">-</span><span class="lit">1</span>
  3. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">gmic</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">1.7.9+zart</span><span class="pun">-</span><span class="lit">4build3</span>
  4. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">gutenprint</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">5.2</span><span class="pun">.</span><span class="lit">13</span><span class="pun">-</span><span class="lit">2</span>
  5. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">ca</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  6. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">de</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  7. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">el</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  8. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">en</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  9. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">es</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  10. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">fr</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  11. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">it</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  12. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">ja</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  13. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">ko</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  14. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">nl</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  15. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">nn</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  16. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">pt</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  17. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">ru</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  18. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">sl</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  19. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">help</span><span class="pun">-</span><span class="pln">sv</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2.8</span><span class="pun">.</span><span class="lit">2</span><span class="pun">-</span><span class="lit">0.1</span>
  20. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> gimp</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">-</span><span class="pln">registry</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">7.20140602ubuntu3</span>
  21. <span class="pln">gimp </span><span class="pun">=></span><span class="pln"> xcftools</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">1.0</span><span class="pun">.</span><span class="lit">7</span><span class="pun">-</span><span class="lit">6</span>

要列出增强所有已安装包的,请运行:

  1. <span class="pln">$ check</span><span class="pun">-</span><span class="pln">enhancements </span><span class="pun">-</span><span class="kwd">ip</span>
  2. <span class="pln">autoconf </span><span class="pun">=></span><span class="pln"> autoconf</span><span class="pun">-</span><span class="pln">archive</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">20170928</span><span class="pun">-</span><span class="lit">2</span>
  3. <span class="pln">btrfs</span><span class="pun">-</span><span class="pln">progs </span><span class="pun">=></span><span class="pln"> snapper</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">0.5</span><span class="pun">.</span><span class="lit">4</span><span class="pun">-</span><span class="lit">3</span>
  4. <span class="pln">ca</span><span class="pun">-</span><span class="pln">certificates </span><span class="pun">=></span><span class="pln"> ca</span><span class="pun">-</span><span class="pln">cacert</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">2011.0523</span><span class="pun">-</span><span class="lit">2</span>
  5. <span class="pln">cryptsetup </span><span class="pun">=></span><span class="pln"> mandos</span><span class="pun">-</span><span class="pln">client</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">1.7</span><span class="pun">.</span><span class="lit">19</span><span class="pun">-</span><span class="lit">1</span>
  6. <span class="pln">dpkg </span><span class="pun">=></span><span class="pln"> debsig</span><span class="pun">-</span><span class="pln">verify</span><span class="pun">:</span><span class="typ">Installed</span><span class="pun">:</span><span class="pun">(</span><span class="pln">none</span><span class="pun">)</span><span class="typ">Candidate</span><span class="pun">:</span><span class="lit">0.18</span>
  7. <span class="pun">[...]</span>

 

3、 dgrep

顾名思义,dgrep 用于根据给定的正则表达式搜索制指定包的所有文件。例如,我将在 Vim 包中搜索包含正则表达式 “text” 的文件。

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="pln"> dgrep </span><span class="str">"text"</span><span class="kwd">vim</span>
  2. <span class="typ">Binary</span><span class="kwd">file</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">.</span><span class="pln">tiny matches</span>
  3. <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">doc</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">/</span><span class="pln">copyright</span><span class="pun">:</span><span class="pln"> that they must </span><span class="kwd">include</span><span class="kwd">this</span><span class="pln"> license text</span><span class="pun">.</span><span class="typ">You</span><span class="pln"> can also distribute</span>
  4. <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">doc</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">/</span><span class="pln">copyright</span><span class="pun">:</span><span class="kwd">include</span><span class="kwd">this</span><span class="pln"> license text</span><span class="pun">.</span><span class="typ">You</span><span class="pln"> are also allowed to </span><span class="kwd">include</span><span class="pln"> executables</span>
  5. <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">doc</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">/</span><span class="pln">copyright</span><span class="pun">:</span><span class="lit">1</span><span class="pun">)</span><span class="typ">This</span><span class="pln"> license text must be included unmodified</span><span class="pun">.</span>
  6. <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">doc</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">/</span><span class="pln">copyright</span><span class="pun">:</span><span class="pln"> text under a</span><span class="pun">)</span><span class="pln"> applies to those changes</span><span class="pun">.</span>
  7. <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">doc</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">/</span><span class="pln">copyright</span><span class="pun">:</span><span class="pln"> context </span><span class="kwd">diff</span><span class="pun">.</span><span class="typ">You</span><span class="pln"> can choose what license to </span><span class="kwd">use</span><span class="kwd">for</span><span class="kwd">new</span><span class="pln"> code you</span>
  8. <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">doc</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">/</span><span class="pln">copyright</span><span class="pun">:</span><span class="pln"> context </span><span class="kwd">diff</span><span class="pln"> will </span><span class="kwd">do</span><span class="pun">.</span><span class="typ">The</span><span class="pln"> e</span><span class="pun">-</span><span class="pln">mail address to be used </span><span class="kwd">is</span>
  9. <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">doc</span><span class="pun">/</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">/</span><span class="pln">copyright</span><span class="pun">:</span><span class="typ">On</span><span class="typ">Debian</span><span class="pln"> systems</span><span class="pun">,</span><span class="pln"> the complete text of the GPL version </span><span class="lit">2</span><span class="pln"> license can be</span>
  10. <span class="pun">[...]</span>

dgrep 支持大多数 grep 的选项。参阅以下指南以了解 grep 命令。

 

4、 dglob

dglob 实用程序生成与给定模式匹配的包名称列表。例如,找到与字符串 “vim” 匹配的包列表。

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="pln"> dglob </span><span class="kwd">vim</span>
  2. <span class="kwd">vim</span><span class="pun">-</span><span class="pln">tiny</span><span class="pun">:</span><span class="pln">amd64</span>
  3. <span class="kwd">vim</span><span class="pun">:</span><span class="pln">amd64</span>
  4. <span class="kwd">vim</span><span class="pun">-</span><span class="pln">common</span><span class="pun">:</span><span class="pln">all</span>
  5. <span class="kwd">vim</span><span class="pun">-</span><span class="pln">runtime</span><span class="pun">:</span><span class="pln">all</span>

默认情况下,dglob 将仅显示已安装的软件包。如果要列出所有包(包括已安装的和未安装的),使用 -a 标志。

  1. <span class="pln">$ </span><span class="kwd">sudo</span><span class="pln"> dglob </span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">a</span>

 

5、 debget

debget 实用程序将在 APT 的数据库中下载一个包的 .deb 文件。请注意,它只会下载给定的包,不包括依赖项。

  1. <span class="pln">$ debget </span><span class="kwd">nano</span>
  2. <span class="typ">Get</span><span class="pun">:</span><span class="lit">1</span><span class="pln"> http</span><span class="pun">:</span><span class="com">//in.archive.ubuntu.com/ubuntu bionic/main amd64 nano amd64 2.9.3-2 [231 kB]</span>
  3. <span class="typ">Fetched</span><span class="lit">231</span><span class="pln"> kB </span><span class="kwd">in</span><span class="lit">2s</span><span class="pun">(</span><span class="lit">113</span><span class="pln"> kB</span><span class="pun">/</span><span class="pln">s</span><span class="pun">)</span>

 

6、 dpigs

这是此次集合中另一个有用的实用程序。dpigs 实用程序将查找并显示那些占用磁盘空间最多的已安装包。

  1. <span class="pln">$ dpigs</span>
  2. <span class="lit">260644</span><span class="pln"> linux</span><span class="pun">-</span><span class="pln">firmware</span>
  3. <span class="lit">167195</span><span class="pln"> linux</span><span class="pun">-</span><span class="pln">modules</span><span class="pun">-</span><span class="pln">extra</span><span class="pun">-</span><span class="lit">4.15</span><span class="pun">.</span><span class="lit">0</span><span class="pun">-</span><span class="lit">20</span><span class="pun">-</span><span class="kwd">generic</span>
  4. <span class="lit">75186</span><span class="pln"> linux</span><span class="pun">-</span><span class="pln">headers</span><span class="pun">-</span><span class="lit">4.15</span><span class="pun">.</span><span class="lit">0</span><span class="pun">-</span><span class="lit">20</span>
  5. <span class="lit">64217</span><span class="pln"> linux</span><span class="pun">-</span><span class="pln">modules</span><span class="pun">-</span><span class="lit">4.15</span><span class="pun">.</span><span class="lit">0</span><span class="pun">-</span><span class="lit">20</span><span class="pun">-</span><span class="kwd">generic</span>
  6. <span class="lit">55620</span><span class="pln"> snapd</span>
  7. <span class="lit">31376</span><span class="kwd">git</span>
  8. <span class="lit">31070</span><span class="pln"> libicu60</span>
  9. <span class="lit">28420</span><span class="kwd">vim</span><span class="pun">-</span><span class="pln">runtime</span>
  10. <span class="lit">25971</span><span class="kwd">gcc</span><span class="pun">-</span><span class="lit">7</span>
  11. <span class="lit">24349</span><span class="pln"> g</span><span class="pun">++-</span><span class="lit">7</span>

如你所见,linux-firmware 包占用的磁盘空间最多。默认情况下,它将显示占用磁盘空间的 前 10 个包。如果要显示更多包,例如 20 个,运行以下命令:

  1. <span class="pln">$ dpigs </span><span class="pun">-</span><span class="pln">n </span><span class="lit">20</span>

 

7. debman

debman 实用程序允许你轻松查看二进制文件 .deb 中的手册页而不提取它。你甚至不需要安装 .deb 包。以下命令显示 nano 包的手册页。

  1. <span class="pln">$ debman </span><span class="pun">-</span><span class="pln">f nano_2</span><span class="pun">.</span><span class="lit">9.3</span><span class="pun">-</span><span class="lit">2</span><span class="pln">_amd64</span><span class="pun">.</span><span class="pln">deb </span><span class="kwd">nano</span>

如果你没有 .deb 软件包的本地副本,使用 -p 标志下载并查看包的手册页。

  1. <span class="pln">$ debman </span><span class="pun">-</span><span class="pln">p </span><span class="kwd">nano</span><span class="kwd">nano</span>

建议阅读:

 

8、 debmany

安装的 Debian 包不仅包含手册页,还包括其它文件,如确认、版权和自述文件等。debmany 实用程序允许你查看和读取那些文件。

  1. <span class="pln">$ debmany </span><span class="kwd">vim</span>

献给 Debian 和 Ubuntu 用户的一组实用程序

使用方向键选择要查看的文件,然后按回车键查看所选文件。按 q 返回主菜单。

如果未安装指定的软件包,debmany 将从 APT 数据库下载并显示手册页。应安装 dialog 包来阅读手册页。

 

9、 popbugs

如果你是开发人员,popbugs 实用程序将非常有用。它将根据你使用的包显示一个定制的发布关键 bug 列表(使用 popularity-contest 数据)。对于那些不关心的人,popularity-contest 包设置了一个 cron (定时)任务,它将定期匿名向 Debian 开发人员提交有关该系统上最常用的 Debian 软件包的统计信息。这些信息有助于 Debian 做出决定,例如哪些软件包应该放在第一张 CD 上。它还允许 Debian 改进未来的发行版本,以便为新用户自动安装最流行的软件包。

要生成严重 bug 列表并在默认 Web 浏览器中显示结果,运行:

  1. <span class="pln">$ popbugs</span>

此外,你可以将结果保存在文件中,如下所示。

  1. <span class="pln">$ popbugs </span><span class="pun">--</span><span class="pln">output</span><span class="pun">=</span><span class="pln">bugs</span><span class="pun">.</span><span class="pln">txt</span>

 

10、 which-pkg-broke

此命令将显示给定包的所有依赖项以及安装每个依赖项的时间。通过使用此信息,你可以在升级系统或软件包之后轻松找到哪个包可能会在什么时间损坏了另一个包。

  1. <span class="pln">$ which</span><span class="pun">-</span><span class="pln">pkg</span><span class="pun">-</span><span class="pln">broke </span><span class="kwd">vim</span>
  2. <span class="typ">Package</span><span class="pun"><</span><span class="pln">debconf</span><span class="pun">-</span><span class="lit">2.0</span><span class="pun">></span><span class="pln"> has </span><span class="kwd">no</span><span class="pln"> install </span><span class="kwd">time</span><span class="kwd">info</span>
  3. <span class="pln">debconf </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">40</span><span class="lit">2018</span>
  4. <span class="kwd">gcc</span><span class="pun">-</span><span class="lit">8</span><span class="pun">-</span><span class="pln">base</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">41</span><span class="lit">2018</span>
  5. <span class="pln">libacl1</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">41</span><span class="lit">2018</span>
  6. <span class="pln">libattr1</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">41</span><span class="lit">2018</span>
  7. <span class="pln">dpkg </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">41</span><span class="lit">2018</span>
  8. <span class="pln">libbz2</span><span class="pun">-</span><span class="lit">1.0</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">41</span><span class="lit">2018</span>
  9. <span class="pln">libc6</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">42</span><span class="lit">2018</span>
  10. <span class="pln">libgcc1</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">42</span><span class="lit">2018</span>
  11. <span class="pln">liblzma5</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">42</span><span class="lit">2018</span>
  12. <span class="pln">libdb5</span><span class="pun">.</span><span class="lit">3</span><span class="pun">:</span><span class="pln">amd64 </span><span class="typ">Wed</span><span class="typ">Apr</span><span class="lit">25</span><span class="lit">08</span><span class="pun">:</span><span class="lit">08</span><span class="pun">:</span><span class="lit">42</span><span class="lit">2018</span>
  13. <span class="pun">[...]</span>

 

11、 dhomepage

dhomepage 实用程序将在默认 Web 浏览器中显示给定包的官方网站。例如,以下命令将打开 Vim 编辑器的主页。

  1. <span class="pln">$ dhomepage </span><span class="kwd">vim</span>

这就是全部了。Debian-goodies 是你武器库中必备的工具。即使我们不经常使用所有这些实用程序,但它们值得学习,我相信它们有时会非常有用。

我希望这很有用。更多好东西要来了。敬请关注!

干杯!


via: https://www.ostechnix.com/debian-goodies-a-set-of-useful-utilities-for-debian-and-ubuntu-users/

作者:SK 选题:lujun9972 译者:MjSeven 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出

相关推荐