To find dependencies for a package, run
apt-cache depends PACKAGE_NAME
Example
root@ubuntu-s-4vcpu-8gb-nyc1-01:~# apt-cache depends php7.2 php7.2 |Depends: libapache2-mod-php7.2 |Depends: php7.2-fpm Depends: php7.2-cgi Depends: php7.2-common root@ubuntu-s-4vcpu-8gb-nyc1-01:~#
In above example, when you install php7.2, it install “libapache2-mod-php7.2”, that will install Apache web server. I had a server with ngtinx, when i install php7.2 package, apache get installed.
You can also use
apt depends PACKAGE_NAME
To find reverse dependency, run
apt-cache rdepends PACKAGE_NAME