apt is a command line interface for Ubuntu package manager.
Apt List Installed Ubuntu Packages
To list all the installed packages, use following command...
sudo apt list --installed
To count, you can just pipe the above output to wc -l
sudo apt list --installed | wc -l 781
Of course you can pipe to any Unix command. Examples...
sudo apt list --installed | less sudo apt list --installed | egrep <pkg_name>
Dpkg-query List Installed Ubuntu Packages
dpkg-query is old way of querying installed packages on Ubuntu. The command is still available on newer versions too.
To list installed packages, run following command...
sudo dpkg-query -l
And the pipe commands can be used to narrow down the results....
sudo dpkg-query -l | less sudo dpkg-query -l | egrep <pkg_name>