The Whereis command can only be used for the search of program names, and only binary files (parameter-B), man description file (parameter-m), and source code files (parameter-s) are searched. 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 instance:
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.
View a full set of articles: Http://www.bianceng.cn/OS/Linux/201301/35075.htm