Difference between find, locate and whereis linux commands

find: finds files by filename. see Linux: Search for a File by Filename for more details and example usages.

locate: also finds files by filename but does not search the directory structure itself but only a database prepared by updatedb. Because of that locate is faster than find but less accurate. Examples:

locate firefox
# ->    /etc/firefox
#       /etc/firefox-3.0
#       /etc/firefox-3.5
#       /etc/alternatives/firefox-homepage
#       /etc/alternatives/firefox-homepage-locales
#       [ ... and many more results ... ]

locate a_file_that_i_just_created
# -> no results

whereis: finds source, binary and manual files by name. Examples:

whereis find
# -> find: /usr/bin/find /usr/share/man/man1/find.1.gz

whereis firefox
# -> firefox: /usr/bin/firefox /etc/firefox /usr/lib/firefox /usr/lib64/firefox /usr/share/firefox /usr/share/man/man1/firefox.1.gz

Which to use: find, locate or whereis

It really depends on what you want to do:

If you want to find a linux program (or its source or documentation) use whereis.

If you want to find an often-used file or want to perform a quick but not too accurate first search for a file use locate.

If you want to find one of your personally created files use find if you know approximately where to look or have a lot of time (searching for a file by name using find from the root takes some time). If you do not, use locate first as it is quicker. If it did not find the file you can still use find afterwards.