【已解决】Ubuntu中查看某个软件包所包含的内容

【背景】

之前知道Ubuntu下,有个build-essential,其下是包含很多开发工具的。

现在想要,在我已经安装好build-essential的前提下,如何查看其中包含了哪些模块(软件包)。

【解决过程】

1.参考:

3. Getting information about packages

去试试dpkg,最终是通过

apt-cache showpkg xxx

可以查看到对应的包的信息:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ dpkg --help
Usage: dpkg [<option> ...] <command>

Commands:
  -i|--install       <.deb file name> ... | -R|--recursive <directory> ...
  --unpack           <.deb file name> ... | -R|--recursive <directory> ...
  -A|--record-avail  <.deb file name> ... | -R|--recursive <directory> ...
  --configure        <package> ... | -a|--pending
  --triggers-only    <package> ... | -a|--pending
  -r|--remove        <package> ... | -a|--pending
  -P|--purge         <package> ... | -a|--pending
  --get-selections [<pattern> ...] Get list of selections to stdout.
  --set-selections                 Set package selections from stdin.
  --clear-selections               Deselect every non-essential package.
  --update-avail <Packages-file>   Replace available packages info.
  --merge-avail <Packages-file>    Merge with info from file.
  --clear-avail                    Erase existing available info.
  --forget-old-unavail             Forget uninstalled unavailable pkgs.
  -s|--status <package> ...        Display package status details.
  -p|--print-avail <package> ...   Display available version details.
  -L|--listfiles <package> ...     List files `owned' by package(s).
  -l|--list [<pattern> ...]        List packages concisely.
  -S|--search <pattern> ...        Find package(s) owning file(s).
  -C|--audit                       Check for broken package(s).
  --add-architecture <arch>        Add <arch> to the list of architectures.
  --remove-architecture <arch>     Remove <arch> from the list of architectures.
  --print-architecture             Print dpkg architecture.
  --print-foreign-architectures    Print allowed foreign architectures.
  --compare-versions <a> <op> <b>  Compare version numbers - see below.
  --force-help                     Show help on forcing.
  -Dh|--debug=help                 Show help on debugging.

  -?, --help                       Show this help message.
      --version                    Show the version.

Use dpkg -b|--build|-c|--contents|-e|--control|-I|--info|-f|--field|
 -x|--extract|-X|--vextract|--fsys-tarfile  on archives (type dpkg-deb --help).

For internal use: dpkg --assert-support-predepends | --predep-package |
  --assert-working-epoch | --assert-long-filenames | --assert-multi-conrep |
  --assert-multi-arch.

Options:
  --admindir=<directory>     Use <directory> instead of /var/lib/dpkg.
  --root=<directory>         Install on a different root directory.
  --instdir=<directory>      Change installation dir without changing admin dir.
  --path-exclude=<pattern>   Do not install paths which match a shell pattern.
  --path-include=<pattern>   Re-include a pattern after a previous exclusion.
  -O|--selected-only         Skip packages not selected for install/upgrade.
  -E|--skip-same-version     Skip packages whose same version is installed.
  -G|--refuse-downgrade      Skip packages with earlier version than installed.
  -B|--auto-deconfigure      Install even if it would break some other package.
  --[no-]triggers            Skip or force consequential trigger processing.
  --no-debsig                Do not try to verify package signatures.
  --no-act|--dry-run|--simulate
                             Just say what we would do - don't do it.
  -D|--debug=<octal>         Enable debugging (see -Dhelp or --debug=help).
  --status-fd <n>            Send status change updates to file descriptor <n>.
  --status-logger=<command>  Send status change updates to <command>'s stdin.
  --log=<filename>           Log status changes and actions to <filename>.
  --ignore-depends=<package>,...
                             Ignore dependencies involving <package>.
  --force-...                Override problems (see --force-help).
  --no-force-...|--refuse-...
                             Stop when problems encountered.
  --abort-after <n>          Abort after encountering <n> errors.

Comparison operators for --compare-versions are:
  lt le eq ne ge gt       (treat empty version as earlier than any version);
  lt-nl le-nl ge-nl gt-nl (treat empty version as later than any version);
  < << <= = >= >> >       (only for compatibility with control file syntax).

Use `dselect' or `aptitude' for user-friendly package management.
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ dpkg -L build-essential
dpkg-query: package 'build-essential' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ apt-cache info build-essential
E: Invalid operation info
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ apt-cache --help
apt 0.9.7.7ubuntu4 for i386 compiled on Apr 12 2013 23:49:20
Usage: apt-cache [options] command
       apt-cache [options] showpkg pkg1 [pkg2 ...]
       apt-cache [options] showsrc pkg1 [pkg2 ...]

apt-cache is a low-level tool used to query information
from APT's binary cache files

Commands:
   gencaches - Build both the package and source cache
   showpkg - Show some general information for a single package
   showsrc - Show source records
   stats - Show some basic statistics
   dump - Show the entire file in a terse form
   dumpavail - Print an available file to stdout
   unmet - Show unmet dependencies
   search - Search the package list for a regex pattern
   show - Show a readable record for the package
   depends - Show raw dependency information for a package
   rdepends - Show reverse dependency information for a package
   pkgnames - List the names of all packages in the system
   dotty - Generate package graphs for GraphViz
   xvcg - Generate package graphs for xvcg
   policy - Show policy settings

Options:
  -h   This help text.
  -p=? The package cache.
  -s=? The source cache.
  -q   Disable progress indicator.
  -i   Show only important deps for the unmet command.
  -c=? Read this configuration file
  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp
See the apt-cache(8) and apt.conf(5) manual pages for more information.
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ apt-cache showpkg build-essential
Package: build-essential
Versions: 
11.6ubuntu4 (/var/lib/apt/lists/mirrors.163.com_ubuntu_dists_raring_main_binary-i386_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise_main_binary-i386_Packages
                  MD5: 90ef0ef86cafda0bd16f746eb621d9da
 Description Language: en
                 File: /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise_main_i18n_Translation-en
                  MD5: 90ef0ef86cafda0bd16f746eb621d9da

11.5ubuntu2.1 (/var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise-updates_main_binary-i386_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise_main_binary-i386_Packages
                  MD5: 90ef0ef86cafda0bd16f746eb621d9da
 Description Language: en
                 File: /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise_main_i18n_Translation-en
                  MD5: 90ef0ef86cafda0bd16f746eb621d9da

11.5ubuntu2 (/var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise_main_binary-i386_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise_main_binary-i386_Packages
                  MD5: 90ef0ef86cafda0bd16f746eb621d9da
 Description Language: en
                 File: /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise_main_i18n_Translation-en
                  MD5: 90ef0ef86cafda0bd16f746eb621d9da


Reverse Depends: 
  virtualbox-source,build-essential
  virtualbox-guest-source,build-essential
  virtualbox-source,build-essential
  virtualbox-guest-source,build-essential
  xdeb,build-essential
  uck,build-essential
  scratchbox2,build-essential
  ruby-build,build-essential
  r-base-dev,build-essential
  python3-pip,build-essential
  python-pip,build-essential
  packaging-dev,build-essential
  npm,build-essential
  linux-wlan-ng-firmware,build-essential
  libdvdread4,build-essential
  kernel-package,build-essential
  gnulib,build-essential
  drizzle-plugin-dev,build-essential
  dh-make-drupal,build-essential
  debpear,build-essential
  bundler,build-essential
  blends-dev,build-essential
  apt-build,build-essential
  rubygems,build-essential
  gem2deb,build-essential
  flex,build-essential
  dpkg-dev,build-essential
  dkms,build-essential
  dh-make,build-essential
  dh-buildinfo,build-essential 7
  devscripts,build-essential
  virtualbox-source,build-essential
  virtualbox-guest-source,build-essential
  ruby-rvm,build-essential
  dpkg-dev,build-essential
  dkms,build-essential
  virtualbox-source,build-essential
  virtualbox-guest-source,build-essential
  rubygems,build-essential
  devscripts,build-essential
  qmail-src,build-essential
  xdeb,build-essential
  virtualbox-source,build-essential
  virtualbox-guest-source,build-essential
  uck,build-essential
  srcinst,build-essential
  scratchbox2,build-essential
  ruby-rvm,build-essential
  r-base-dev,build-essential
  qt-sdk,build-essential
  python-instant,build-essential
  packaging-dev,build-essential
  module-assistant,build-essential
  linux-wlan-ng-firmware,build-essential
  libdvdread4,build-essential
  kernel-package,build-essential
  gnulib,build-essential
  drizzle-plugin-dev,build-essential
  dh-make-drupal,build-essential
  debian-builder,build-essential
  blends-dev,build-essential
  auto-apt,build-essential
  apt-src,build-essential
  apt-build,build-essential
  rubygems,build-essential
  gem2deb,build-essential
  flex,build-essential
  dpkg-dev,build-essential
  dkms,build-essential
  dh-make,build-essential
  dh-buildinfo,build-essential 7
  devscripts,build-essential
Dependencies: 
11.6ubuntu4 - libc6-dev (16 (null)) libc-dev (0 (null)) gcc (2 4:4.4.3) g++ (2 4:4.4.3) make (0 (null)) dpkg-dev (2 1.13.5) 
11.5ubuntu2.1 - libc6-dev (16 (null)) libc-dev (0 (null)) gcc (2 4:4.4.3) g++ (2 4:4.4.3) make (0 (null)) dpkg-dev (2 1.13.5) 
11.5ubuntu2 - libc6-dev (16 (null)) libc-dev (0 (null)) gcc (2 4:4.4.3) g++ (2 4:4.4.3) make (0 (null)) dpkg-dev (2 1.13.5) 
Provides: 
11.6ubuntu4 - 
11.5ubuntu2.1 - 
11.5ubuntu2 - 
Reverse Provides: 
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ 

即,可以看出,build-essential,包含了:

  • libc6-dev
  • libc-dev
  • gcc
  • g++
  • make
  • dpkg-dev

这个和官网对于其解释:

软件包: build-essential (11.4build1)

基本类似。

 

【总结】

1.即使没有安装某模块,比如build-essential,也可以通过

apt-cache showpkg xxx

去查看xxx包的详细信息,包含其中所包含的内容和依赖关系;

2.如果已经安装了xxx模块,则也可以通过

dpkg -L xxx

去查看其信息。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量