Ubuntu – Find the additional packages installed with a given program by apt or apt-get

aptpackage-managementsoftware installationuninstall

I am not aware of another way to do this – if that program has been already installed (not like those installed after installing a specialized program like debfoster) – unless I have saved the message given by apt or apt-get: for example for Thunar it said:

The following additional packages will be installed:
  exo-utils libexo-1-0 libexo-common libexo-helpers libgarcon-1-0
  libgarcon-common libthunarx-2-0 libtumbler-1-0 libwnck-common libwnck22
  libxfce4ui-1-0 libxfce4ui-common libxfce4util-bin libxfce4util-common
  libxfce4util7 libxfconf-0-2 thunar-data thunar-volman tumbler tumbler-common
  xfce4-panel xfconf

Are such information already available in Ubuntu without installing a separate tool like debfoster? So, I am not asking about such tools (as answered here), but about a way to see packages that came with programs already installed through apt or apt-get.

Best Answer

Provided you have not installed anything in the meantime that shares any of the same dependencies, then one way would be to simulate removal of the package and take note of the automatically installed packages:

e.g.

$ sudo apt-get remove --dry-run thunar
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  exo-utils libexo-1-0 libexo-common libexo-helpers libgarcon-1-0 libgarcon-common libthunarx-2-0 libtumbler-1-0 libwnck-common libwnck22 libxfce4ui-1-0
  libxfce4ui-common libxfce4util-bin libxfce4util-common libxfce4util7 libxfconf-0-2 thunar-data tumbler tumbler-common xfce4-panel xfconf
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  thunar thunar-volman
0 upgraded, 0 newly installed, 2 to remove and 123 not upgraded.
Remv thunar-volman [0.8.1-2]
Remv thunar [1.6.11-0ubuntu0.16.04.2]

NOTE: if there are other pending autoremovals (commonly, these are kernel packages resulting from automatic security updates) these will also show up in the output. In order to see only the automatically installed packages for the specific package you are interested in, run sudo apt-get autoremove first so that apt starts from a "clean" state.

Related Question