Linux under the Whereis command and find command a bit similar, Whereis command lookup faster, but can only find the program name, with the following small series to understand the specific use of the Whereis command.
The Whereis command searches only binaries (parameter-B), man description files (parameter-m), and source code files (parameter-s). If the argument is omitted, all information is returned.
Whereis lookups are very fast compared to find, because the Linux system records all of the files in the system in a database file, and when you use the Whereis and the locate that are about to be described below, you look up data from the database, rather than the Find command Traverse hard disk to find, the efficiency will be very high.
But the database file is not a live update and is updated once a week by default, so when we use Whereis and locate to find the file, we sometimes find the data that has been deleted, or we just set up the file, but we can't find it because the database file is not updated.
1. Command format:
Whereis [-BMSU] [BMS directory name-f] File name
2. Command function:
The Whereis command is the location of executable files, source code files, and Help files in the file system. The properties of these files should belong to the original code, binary file, or help file. The Whereis program also has the ability to search for source code, specify alternate search paths, and search for unusual items.
3. Command parameters:
-B locates the executable file.
-M locate Help file.
-S locates the source code file.
-U searches for files other than executables, source code files, and Help files under the default path.
-b Specifies the path to search for an executable file.
-m specifies the path to the search Help file.
-s specifies the path to the search source code file.
4. Use examples:
Example 1: Find files related to * * * files
Command:
Whereis SVN
Output:
[Root@localhost ~]# Whereis Tomcat
Tomcat:
[Root@localhost ~]# Whereis SVN
SVN:/usr/bin/svn/usr/local/svn/usr/share/man/man1/svn.1.gz
Description
Tomcat is not installed, can not find out, SVN installation found a lot of related files
Instance 2: Only binary files are found
Command:
Whereis-b SVN
Output:
[Root@localhost ~]# Whereis-b SVN
SVN:/USR/BIN/SVN/USR/LOCAL/SVN
[Root@localhost ~]# whereis-m SVN
SVN:/usr/share/man/man1/svn.1.gz
[Root@localhost ~]# whereis-s SVN
Svn:
[Root@localhost ~]#
Description
Whereis-m SVN found the documentation path, Whereis-s svn find source file.
Above is the use of Linux under the Whereis command, whereis command search conditions are relatively limited, if you only search program name, use Whereis command is very fast.