Debian – How to find out how a particular package got installed

debianpackage-management

On a particular Debian VM, I want to know how did xterm and x11-utils got installed : were they installed directly (an administrator running apt-get install xterm for example) or as a requirement for other packages ?

Best Answer

Packages which are installed because they’re dependencies are normally flagged as automatic; you can see that with

apt-mark showauto xterm

If that outputs xterm, the package was installed automatically; otherwise it was installed manually.

You can use aptitude to see which dependencies keep a package installed:

aptitude why xterm

aptitude why will also explicitly say if a package was installed manually.