On Red Hat Enterprise Linux, CentOS and Fedora, I’d do this:

yum list installed
For Debian, it's:
dpkg –list