The Whereis command can only be used for program name searches, and only binary files (parameter-B), man description file (parameter-m), and source code file (parameter-s) are searched. If the argument is omitted, all information is returned.
(1) Usage:
usage: whereis [-BMSU] [BMS directory name-f] File name
(2) Function:
Features: the path to the relevant files, such as binaries, source code files, and man manual pages, used to locate instructions.
(3) Option parameters:
1) - B: Only binary files are found
2)-b< directory;: Find binary files only in the directory you set
3)-F: path name before file name is not displayed
4)-M: Find only documentation
5)-m< directory;: Find the description file only in the directory you set
6)-S: Find only the original code file
7)-s< directory;: Find the original code file only in the directory you set
8)-U: Find files that do not contain the specified type
(4) Example:
1) [[email protected] ~]$ Whereis CD find all files related to CD command, including binary, man description file, source code file.
[Email protected] ~/USR/BIN/CD/USR/SHARE/MAN/MAN1/CD. 1. gz/usr/share/man/man1p/~/usr/bin/pwd/usr/include/pwd.h/usr/share/man/man1/pwd. 1. gz/usr/share/man/man1p/pwd.1p.gz
2) [[email protected] ~]$ whereis-b|-s|-m CD
[Email protected] ~]$ whereis-/usr/bin/~]$ whereis-~]$ whereis-/usr/share/man/ MAN1/CD. 1. gz/usr/share/man/man1p/cd.1p.gz
3) [[email protected] ~]$ whereis-f CD
[Email protected] ~]$ Whereis-F CD /USR/BIN/CD/USR/SHARE/MAN/MAN1/CD. 1. gz/usr/share/man/man1p/~/usr/bin/cd/usr/share/man/man1/cd. 1. gz/usr/share/man/man1p/cd.1p.gz
4) [[email protected] ~]$ Whereis Whereis
[Email protected] ~/usr/bin/whereis/usr/share/man/man1/whereis. 1 ~]$ whereis-/usr/bin/~]$ whereis-/usr/share/man/man1/whereis. 1 ~]$ whereis-s Whereis
(5) Other:
Description
Whereis looks very fast compared to find, because the Linux system records all the files in the system in a single database file, and when you use Whereis and the locate described below, the data is looked up from the database, not like the Find command, By traversing the hard drive to find, the efficiency will naturally be very high. However, the database file is not updated in real time and is updated once a week by default, so when we use Whereis and locate to find files, we sometimes find data that has been deleted, or just created the file, but cannot find it because the database file is not updated.
One Linux command per day (whereis) command