dpkg -l
dpkg -l pattern
dpkg --list pattern
dpkg -l |awk '/^[hi]i/{print $2}'
dpkg -l | grep '^ii '
dpkg-query -l | less
dpkg-query -l | grep ansible
dpkg --get-selections
dpkg --get-selections | grep -v deinstall
dpkg --get-selections | grep ansible
dpkg --get-selections | grep -w "install"
dpkg --get-selections | grep -w "install" | cut -f1
apt list
apt list pattern
apt list -a sudo
apt list --installed
apt list --installed pattern
apt list --installed | grep ansible
apt list --installed | awk '{split($0, a, "/"); print a[1]}'
apt list --manual-installed=true
apt-mark showmanual
apt show '~i' -a
apt-cache pkgnames
apt-cache policy <package_name>
apt-cache policy ansible
zgrep " installed " /var/log/dpkg.log*
grep " install " /var/log/apt/history.log
cat /var/lib/apt/lists/ppa.launchpad.net_*_Packages | grep '^Package:'
awk '/^Package: / {print $2}' /var/lib/apt/lists/ppa.launchpad.net_*_Packages | sort -u
grep Package /var/lib/apt/lists/ppa.launchpad.net_*_Packages
grep -h -P -o "^Package: \K.*" /var/lib/apt/lists/ppa.launchpad.net_*_Packages | sort -u
grep ^Package /var/lib/apt/lists/ppa.launchpad.net_*_Packages | awk '{print $2}' | sort | uniq
grep ^Package /var/lib/apt/lists/ppa.launchpad.net_*_Packages | awk '{print $2}' | sort -u
grep ' installed ' /var/log/dpkg.log /var/log/dpkg.log.1 | awk '{print $5}' | sort -u
#Intentionally Installed
(zcat $(ls -tr /var/log/apt/history.log*.gz); cat /var/log/apt/history.log) 2>/dev/null | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | egrep '^Commandline:'
(zcat $(ls -tr /var/log/apt/history.log*.gz); cat /var/log/apt/history.log) 2>/dev/null | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | egrep -B1 '^Commandline:'
zgrep -hE '^(Start-Date:|Commandline:)' $(ls -tr /var/log/apt/history.log ) | egrep -v 'aptdaemon|upgrade' | egrep -B1 '^Commandline:'
#sudo apt install dctrl-tools
grep-dctrl -sPackage . /var/lib/apt/lists/ppa.launchpad.net_*_Packages
grep-status -FStatus -sPackage -n "install ok installed"
#sudo apt install aptitude
aptitude search '~i!~M'
aptitude search -F "%p %V %v" "?narrow(?installed,?not(?archive(stable)))" | grep ansible
#To exclude just stable you need to anchor the regex pattern:
aptitude search -F "%p %V %v %t" '?any-version(?installed ?not(?archive("^stable$")))'
#To exclude multiple repositories:
aptitude search -F "%p %V %v %t" '?any-version(?installed ?not(?archive("^(xenial|xenial-updates)$")))'
#count
sudo dpkg-query -f '${binary:Package}\n' -W | wc -l
#ppa-purge
apt install ppa-purge
Then get ppa list by tab-completion
ppa-purge -o (hit Tab key twice)