Debian Based Distros
The below command should work for Debain, Ubuntu, and the Raspberry Pi Raspbian.
RPM Based Distros
The following works on Fedora, CentOS, ReHat.
The above commands return all of the packages installed on a system. If you want to look for a specific program or package you can use grep to filter the results.
rpm -qa | grep program
dpkg --get-selections | grep program