0

Some application may installed with a bunch of packages. For example, vim can go along with packages: vim-gnome, vim-gtk, vim-nox etc. To uninstall application I need to define what is the exaxt package actually installed me an application. How to define it? I would like to get it via command line.


The answer for my question slightly differs from answers to question:

$ dpkg -S "$(readlink -f `which vim`)"
Loom
  • 576
  • Don't just look at the top or accepted answer of the linked question! The answer to your question is in this answer and based on apt-file. – David Foerster May 08 '16 at 07:45
  • @DavidFoerster - Thank you. Actually for my purposes it less convenient than dpkg -S because apt-file find vim returns irrelevant result. There is a command apt-file find"$(basename $(readlink -f `which vim`))"that returns two strings withvim-noxandvim-nox-py2and I need to choose one of them. Anddpkg -S "$(readlink -f `which vim`)"returnsvim-nox` only – Loom May 08 '16 at 12:15

2 Answers2

1
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]
DopeGhoti
  • 733
  • 4
  • 11
0

I think you should use apt-file for this.

$ sudo apt-get install apt-file

Then, you would use it like this

$ apt-file search `which vim`
Iyad K
  • 384