packages with debian/ubuntu

list installed packages

https://askubuntu.com/questions/17823/how-to-list-all-installed-packages

apt list --installed
dpkg --get-selections | grep <bla>
dpkg --get-selections | grep -v deinstall >list.txt
dpkg --get-selections > list.txt
# clear: to deinstall any packages not in list given to following --set-selections.
dpkg --clear-selections
sudo dpkg --set-selections < list.txt

find / list available packages

https://askubuntu.com/questions/160897/how-do-i-search-for-available-packages-from-the-command-line

apt-cache search <keyword>

list package dependencies

apt-cache depends <package_name>
apt-cache rdepends <package_name>

list files of package or of installed files

https://superuser.com/questions/82923/how-to-list-files-of-a-debian-package-without-install

https://askubuntu.com/questions/160897/how-do-i-search-for-available-packages-from-the-command-line

https://askubuntu.com/questions/32507/how-do-i-get-a-list-of-installed-files-from-a-package

sudo apt-get install apt-file
sudo apt-file update
apt-file list <package_name>
# apt-file list pigpiod
apt-cache search <keyword>
# apt-cache search rabbitmq
dpkg -L <package_name> # -L == --listfiles
# dpkg -L librabbitmq-dev

find package, owning a file

see https://www.cyberciti.biz/faq/equivalent-of-rpm-qf-command/

dpkg -S <file>

force reinstall

apt-get --reinstall install <package>