Why doesn't "whereis" locate a file?

10,078

Solution 1

whereis doesn't locate files, because whereis command is not intended to be used for that.

From whereis manpage

whereis - locate the binary, source, and manual page files for a command

whereis locates source/binary and manuals sections for specified files. The supplied names are first stripped of leading pathname components and any (single) trailing extension of the form .ext, for example, .c. Prefixes of s. resulting from use of source code control are also dealt with. whereis then attempts to locate the desired program in a list of standard Linux places.

For more information type man whereis in your terminal to refer the man page. For finding a file you have to use commands like grep, find, locate, etc...

Solution 2

What you're probably looking for is locate.

The locate man page: http://manpages.ubuntu.com/manpages/precise/en/man1/locate.findutils.1.html

Ubuntu's Community Help Wiki has an entry for finding files. Check it out here:

https://help.ubuntu.com/community/FindingFiles

Share:
10,078

Related videos on Youtube

Paul
Author by

Paul

Updated on September 18, 2022

Comments

  • Paul
    Paul almost 2 years

    I was looking for a specific file using whereis from the command line.

    I got a rather useless result, but I then found the exact file I was looking for by manually searching.

    I did not make a mistake in the command line. Why didn't whereis turn up all my files? Is there another method?

    • RobotHumans
      RobotHumans over 11 years
      find / | grep filename
    • RobotHumans
      RobotHumans over 11 years
      fair point, but updatedb takes time
    • Erhannis
      Erhannis over 11 years
      Er, I'm pretty sure he meant that normally you'd type that as "find -name 'filename'"
  • saji89
    saji89 over 11 years
    @Web-E, Thanks for adding that link.