A couple of good commands to know are
whereis commandname locate commandname
Both of these will help you find where a particular file is located. whereis uses a database which is updated using updatedb command.
locate searches your current users paths for the command.
Check out the man page on both for more information.
I think you've got them mixed up.
'Locate' uses a database to find any file while 'whereis' searches a hardcoded path for various files related to a program.
which <command> tells you instantly where the binary (or symbolic link) of a program is. It is a shell builtin command that uses the current path like running any command does.
Chris