Get a list of installed packages in Debian

dpkg:

dpkg --get-selections
apt:
apt list --installed