如何获取Ubuntu软件包的描述,只有从元数据数据库中获取?

要获取Mac端口的包装描述和/或“长描述”,我可以这样做:

port info --description --long_description vim 

并过滤掉我不需要的信息。

我如何在Ubuntu中这样做?

我已经阅读了dpkg系列以及apt-cache和类似的手册页,但是对于元数据库返回的字段(如上所述),我没有find精细的控制。

有没有我错过的命令的选项? 我应该采取parsing和削减输出?

特别是,我需要把“长描述”作为一个单行。

grep-aptavailgrep-dctrlgrep-available ,分别在特定的Packages文件或本地安装的软件包的dkpg基础中找​​到这些信息)是最精确的工具:

 grep-aptavail -s Description -PX packagename 

例:

 $ grep-aptavail -PX 'apache2' -s Description Description: Apache HTTP Server metapackage The Apache Software Foundation's goal is to build a secure, efficient and extensible HTTP server as standards-compliant open source software. The result has long been the number one web server on the Internet. . It features support for HTTPS, virtual hosting, CGI, SSI, IPv6, easy scripting and database integration, request/response filtering, many flexible authentication schemes, and more.* 

注意:

Debian(和Ubuntu)包在其描述中有两个部分:

  • Description字段的第一行是简短描述,它出现在apt-cache search packagename ;
  • 说明字段的其余部分(从第二行开始)是长描述。

出于这个原因,你可以把简短的描述作为一个单行的,但是长描述在定义上分散在几行上。

这不完全是你想要的,但是

 aptitude show packagename | grep ^Description: 

应该做的伎俩。