我想知道如何在安装之前在终端中获取有关包的信息,以便apt install
我可以根据描述决定是否安装它。
谢谢!
答案1
使用
apt-cache show PACKAGE
安装后查看包的描述和其他信息
dpkg -L package_name
查看包中包含哪些文件。
答案2
对于类似的任务,APT(高级包工具)包管理系统提供了几种解决方案(https://en.wikipedia.org/wiki/Advanced_Packaging_Tool)。
apt-cache showpkg *package_name*
描述取自此处https://linux.die.net/man/8/apt-cache
showpkg 显示命令行上列出的软件包的信息。其余参数是软件包名称。列出每个软件包的可用版本和反向依赖关系,以及每个版本的正向依赖关系。正向(正常)依赖关系是相关软件包所依赖的软件包;反向依赖关系是依赖于相关软件包的软件包。因此,软件包必须满足正向依赖关系,但反向依赖关系则不必满足。例如,apt-cache showpkg libreadline2 将产生类似于以下内容的输出
$ apt-cache showpkg javacc
Package: javacc
Versions:
5.0-5 (/var/lib/apt/lists/ftp.ru.debian.org_debian_dists_jessie_main_binary-amd64_Packages) (/var/lib/apt/lists/httpredir.debian.org_debian_dists_jessie_main_binary-am)
Description Language:
File: /var/lib/apt/lists/ftp.ru.debian.org_debian_dists_jessie_main_binary-amd64_Packages
MD5: 61505d89a764133cbd782b370c93fe98
Description Language: en
File: /var/lib/apt/lists/ftp.ru.debian.org_debian_dists_jessie_main_i18n_Translation-en
MD5: 61505d89a764133cbd782b370c93fe98
Reverse Depends:
ant-optional,javacc
ant-optional,javacc
libjavacc-maven-plugin-java,javacc
javacc-doc,javacc
ant-optional,javacc
Dependencies:
5.0-5 - default-jre-headless (16 (null)) java1-runtime-headless (16 (null)) java2-runtime-headless (0 (null)) javacc-doc (0 (null))
Provides:
5.0-5 -
Reverse Provides:
apt-cache 显示包裹名字
显示命名包的包记录。
$ apt-cache show javacc
Package: javacc
Version: 5.0-5
Installed-Size: 380
Maintainer: Debian Java Maintainers <[email protected]>
Architecture: all
Depends: default-jre-headless | java1-runtime-headless | java2-runtime-headless
Suggests: javacc-doc
Description-en: Parser generator for use with Java
Java Compiler-Compiler (JavaCC) is (according to sun)
"the most popular parser generator" for use with Java [tm]
applications.
.
A parser generator is a tool that reads a grammar specification
and converts it to a Java program that can recognize matches to
the grammar. In addition to the parser generator itself, JavaCC
provides other standard capabilities related to parser
generation such as tree building (via a tool called JJTree
included with JavaCC), actions, debugging, etc.
Description-md5: 61505d89a764133cbd782b370c93fe98
Homepage: http://javacc.java.net
Tag: devel::code-generator, devel::lang:java, implemented-in::java,
interface::commandline, role::program, scope::utility
Section: java
Priority: optional
Filename: pool/main/j/javacc/javacc_5.0-5_all.deb
Size: 284722
MD5sum: b1efd2defeba45cd97a48541235e6255
SHA1: c5e4b1991be06ec56e6d1a5b916c714068e5bf6b
SHA256: 757f9566d488858285c23c2ac12e05168af38953cf034f6e44123c2a88cb7c83
apt-cache 策略包裹名字
这是为了帮助调试与首选项文件相关的问题。如果不带参数,它将打印出每个源的优先级。否则,它将打印出有关指定包的优先级选择的详细信息。
$ apt-cache policy javacc
javacc:
Installed: (none)
Candidate: 5.0-5
Version table:
5.0-5 0
500 http://ftp.ru.debian.org/debian/ jessie/main amd64 Packages
500 http://httpredir.debian.org/debian/ jessie/main amd64 Packages
apt-cache madison包裹名字
apt-cache 的 madison 命令试图模仿 Debian 档案管理工具 madison 的输出格式和部分功能。它以表格形式显示软件包的可用版本。与原始 madison 不同,它只能显示 APT 已检索软件包列表的体系结构信息(APT::Architecture)。
$ apt-cache madison javacc
javacc | 5.0-5 | http://ftp.ru.debian.org/debian/ jessie/main amd64 Packages
javacc | 5.0-5 | http://httpredir.debian.org/debian/ jessie/main amd64 Packages
javacc | 5.0-5 | http://ftp.ru.debian.org/debian/ jessie/main Sources
apt-cache 显示 rc包裹名字
显示与给定软件包名称匹配的所有源软件包记录。显示所有版本,以及声明名称为二进制文件的所有记录。
$ apt-cache showsrc javacc
Package: javacc
Binary: javacc, javacc-doc
Version: 5.0-5
Maintainer: Debian Java Maintainers <[email protected]>
Uploaders: Emmanuel Bourg <[email protected]>
Build-Depends: ant, debhelper (>= 7), cdbs (>= 0.4.5.3), default-jdk
Build-Depends-Indep: ant-optional, libxalan2-java, docbook-to-man, junit, maven-repo-helper
Architecture: all
Standards-Version: 3.9.4
Format: 3.0 (quilt)
Files:
6715506605c7a4e750309b7ef645ec86 1397 javacc_5.0-5.dsc
edf47d357c6f36458474a1b537b88a12 711183 javacc_5.0.orig.tar.gz
b3308a9aefeca4318a0838b2a3213cea 7893 javacc_5.0-5.debian.tar.gz
Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-java/trunk/javacc
Vcs-Svn: svn://anonscm.debian.org/pkg-java/trunk/javacc
Checksums-Sha1:
f4a4ea175ce87af588c713eaab8caeaefc64183f 1397 javacc_5.0-5.dsc
f6e12a183579a67528f351282251560faf4737db 711183 javacc_5.0.orig.tar.gz
4aebf3cadecd96f304f80786f07473574569dc02 7893 javacc_5.0-5.debian.tar.gz
Checksums-Sha256:
4a61f89f984809964e3d63d159998ff29c951765a046ac87dca32b21eb54f99b 1397 javacc_5.0-5.dsc
aab2c3e2f37648b9e708e6bad4c8b544cba63b66f1791907e6e3f89609b27150 711183 javacc_5.0.orig.tar.gz
66418d91dc6c6d45d941181d08150d272d3db57a944f3ce61847e5e1ec7c0659 7893 javacc_5.0-5.debian.tar.gz
Homepage: http://javacc.java.net
Package-List:
javacc deb java optional
javacc-doc deb doc optional
Directory: pool/main/j/javacc
Priority: source
Section: java
apt-cache 依赖包裹名字
显示包所具有的每个依赖项的列表以及所有可能满足该依赖项的其他包。
$ apt-cache depends javacc
javacc
|Depends: default-jre-headless
|Depends: <java1-runtime-headless>
gcj-4.8-jre-headless
gcj-4.9-jre-headless
gcj-jre-headless
Depends: <java2-runtime-headless>
default-jre-headless
gcj-4.8-jre-headless
gcj-4.9-jre-headless
gcj-jre-headless
openjdk-7-jre-headless
openjdk-8-jre-headless
Suggests: javacc-doc
测试环境
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
setivolkylany$/media/setivolkylany/WorkDisk/Private$ uname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
基于https://linux.die.net/man/8/apt-cache和 http://manpages.ubuntu.com/manpages/zesty/man8/apt-cache.8.html
答案3
对于那些只想了解该软件包基本概要的人来说:
apt-cache search ^package-name$