How to get information about a package before installation in the terminal?
I was wondering how to get the information about a package in terminal, before installation with apt-get install
so that I can decide whether to install it, based on the description.
Thanks and regards!
Solution 1:
Use
apt-cache show PACKAGE
to see the description and some other information about package after its installed
dpkg -L package_name
to see what files the package contains.
Solution 2:
For similar tasks, the package management system ATP (the Advanced Package Tool) provide several solutions (https://en.wikipedia.org/wiki/Advanced_Packaging_Tool).
apt-cache showpkg package_name
Description taken from here https://linux.die.net/man/8/apt-cache
showpkg displays information about the packages listed on the command line. Remaining arguments are package names. The available versions and reverse dependencies of each package listed are listed, as well as forward dependencies for each version. Forward (normal) dependencies are those packages upon which the package in question depends; reverse dependencies are those packages that depend upon the package in question. Thus, forward dependencies must be satisfied for a package, but reverse dependencies need not be. For instance, apt-cache showpkg libreadline2 would produce output similar to the following
$ 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 show package_name
Displays the package records for the named packages.
$ 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 policy package_name
This is meant to help debug issues relating to the preferences file. With no arguments it will print out the priorities of each source. Otherwise it prints out detailed information about the priority selection of the named package.
$ 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 package_name
apt-cache's madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool, madison. It displays available versions of a package in a tabular format. Unlike the original madison, it can only display information for the architecture for which APT has retrieved package lists (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 showsrc package_name
Displays all the source package records that match the given package names. All versions are shown, as well as all records that declare the name to be a Binary.
$ 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 depends package_name
Shows a listing of each dependency a package has and all the possible other packages that can fulfill that dependency.
$ 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
Testing environment
$ 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
Based on https://linux.die.net/man/8/apt-cache and http://manpages.ubuntu.com/manpages/zesty/man8/apt-cache.8.html