notes/list of installed packages on Debian-GzpDu8wr.sh
#list all installed packages with dpkg

dpkg --get-selections| grep -v deinstall
#get a count of installed packages

dpkg --get-selections| grep -v deinstall|sc -l

#list all installed with apt

apt list --installed
#get a count with apt
apt list --installed|grep -v "^Listing"|sc -l


###backup list of installed packages###
dpkg --get-selections | grep -v deinstall > packages.lst
sudo apt-get install -y $(< packages.lst)

sudo apt-get autoremove

syntax highlighted by Code2HTML, v. 0.9.1