Ok, so you can use rdepends {packagename}
(if you've got rdepends installed) or sudo apt-cache depends {packagename}
and sudo apt-cache rdepends {packagename}
to get the dependencies and reverse-dependencies of any given package.
But what if you want all of the dependencies and reverse-dependencies for all your packages without having to cut-n-paste the package name more than a thousand times?
for packages in $(sudo apt list --installed 2>/dev/null | awk -F '/' '{if (NR!=1) print $1}'); do sudo apt-cache depends $packages; sudo apt-cache rdepends $packages; done
Gives output like this:
accountsservice
Depends: dbus
dbus:i386
Depends: libaccountsservice0
Depends: libc6
Depends: libglib2.0-0
Depends: libpolkit-gobject-1-0
Suggests: gnome-control-center
accountsservice
Reverse Depends:
unity-settings-daemon
xdg-desktop-portal-gtk
mugshot
malcontent
gnome-control-center
gdm3
gdm3
liblightdm-gobject-1-0
xdg-desktop-portal-gtk
libaccountsservice0
language-selector-common
gnome-control-center
gdm3
user-manager
language-selector-common
unity-control-center
mugshot
mate-polkit
liblightdm-gobject-1-0
indicator-sound
cinnamon-control-center
accountsservice-ubuntu-schemas
xdg-desktop-portal-gtk
libaccountsservice0
gdm3
gnome-control-center
ack
Depends: libfile-next-perl
Depends: <perl:any>
perl:i386
perl
Breaks: <ack-grep>
Replaces: <ack-grep>
ack
Reverse Depends:
|libtask-kensho-cli-perl
|myrepos
elpa-counsel
elpa-helm-ag
If you want it in a .txt file:
sudo su
for packages in $(sudo apt list --installed 2>/dev/null | awk -F '/' '{if (NR!=1) print $1}'); do sudo apt-cache depends $packages | tee -a /home/owner/Desktop/dep.txt; sudo apt-cache rdepends $packages | tee -a /home/owner/Desktop/dep.txt; echo '-------------------------' | tee -a /home/owner/Desktop/dep.txt; done
Change /home/owner/Desktop/
to the path to your file, and dep.txt
to the name of the resultant file that you want.
It'll take awhile to run... the resultant file for my system had 201684 lines.