apt-cache showpkg vim
This command with show both the vim
packages dependencies and its reverse dependencies.
A package's dependencies are required for it to be installed; if you install a package, and of its dependencies that are not yet installed will be installed first (recursively: if C depends on B, and B depends on A, the system will ensure that A is first installed, then B, and finally C).
A package's reverse dependencies are what you're asking of: These are the packages for which the stated package is a dependency. So, to use your example:
ghoti@home $ apt-cache showpkg vim
Package: vim
Versions:
2:7.4.1689-3ubuntu1 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_xenial_main_binary-i386_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_xenial_main_binary-i386_Packages
MD5: 59e8b8f7757db8b53566d5d119872de8
Description Language: en
File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_xenial_main_i18n_Translation-en
MD5: 59e8b8f7757db8b53566d5d119872de8
Reverse Depends:
vimhelp-de,vim 2:7.5
vimhelp-de,vim 2:7.4
byobu,vim
vim-vimoutliner,vim
vim-tlib,vim
vim-tabular,vim
[and a whole bunch of others omitted for brevity]
Dependencies:
2:7.4.1689-3ubuntu1 - vim-common (5 2:7.4.1689-3ubuntu1) vim-runtime (5 2:7.4.1689-3ubuntu1) libacl1 (2 2.2.51-8) libc6 (2 2.15) libgpm2 (2 1.20.4) libselinux1 (2 1.32) libtinfo5 (2 6) ctags (0 (null)) vim-doc (0 (null)) vim-scripts (0 (null))
Provides:
[omitted for brevity]
apt-file
. – David Foerster May 08 '16 at 07:45dpkg -S
becauseapt-file find vim
returns irrelevant result. There is a commandapt-file find
"$(basename $(readlink -f `which vim`))"that returns two strings with
vim-noxand
vim-nox-py2and I need to choose one of them. And
dpkg -S "$(readlink -f `which vim`)"returns
vim-nox` only – Loom May 08 '16 at 12:15