Whereis command
Function Description: The whereis command locates executable files, source code files, and help files in the file system. The attributes of these files should belong to the original code, binary file, or help file. The whereis Program also provides the ability to search for source code, specify a backup search path, and search for unusual items. Compared with find, whereis searches very quickly, because the linux system records all files in the system in a database file, when whereis and the locate described below are used, data will be searched from the database, instead of traversing the hard disk like the find command, which will naturally be very efficient. However, the database is not updated in real time. Sometimes the new file cannot be found, and you need to update the database manually.
Syntax: whereis [-bmsu] [BMS directory name-f] File Name
Command parameters:
-B. Locate the executable file.
-M: locate the Help file.
-S: locate the source code file.
-U searches for executable files, source code files, and help files in the default path.
-B specifies the path to search for executable files.
-M specifies the path for searching the Help file.
-S specifies the path to search for source code files.
Search for files related to the crontab file
[Atong @ LiWenTong tmp] $ whereis crontab
Crontab: /usr/bin/crontab/etc/crontab/usr/share/man/man1/crontab.1.gz/usr/share/man/man5/crontab.5.gz/usr/share/man/man1p/crontab.1p.gz
File category
[Atong @ LiWenTong tmp] $ whereis-B crontab-specifies to find the binary file, that is, the executable file.
Crontab:/usr/bin/crontab/etc/crontab
[Atong @ LiWenTong tmp] $ whereis-m crontab --> specify to find the Help File
Crontab:/usr/share/man/man1/crontab.1.gz/usr/share/man/man5/crontab.5.gz/usr/share/man/man1p/crontab.1p.gz
[Instances on the network]
Mao :~ # Whereis vi
Vi:/usr/bin/vi/usr/share/man/man1/vi.1.gz
Mao :~ # Whereis man
Man:/usr/bin/man/usr/local/man/usr/share/man/man1/man.1.gz/usr/share/man/man7/man.7.gz
Mao :~ # Whereis yes
Yes:/usr/bin/yes/usr/share/man/man1/yes.1.gz
Mao :~ # Whereis echo
Echo:/bin/echo/usr/share/man/man1/echo.1.gz
Mao :~ # Whereis less
Less:/usr/bin/less/usr/share/man/man1/less.1.gz
Mao :~ # Whereis fcitx
Fcitx:/usr/bin/fcitx/usr/share/fcitx
------------------------ Subsequent self-Summary ---------------
Whereis is actually similar to our locate and which functions. It can also find execution files and help files. Basically, this command can be replaced by which and locate.
--------------------------------------------------
Search for files in Linux -- type whereis which find locate