How to use linux whereis command

青灯夜游
Release: 2023-02-06 16:11:20
Original
3639 people have browsed it

In Linux, the whereis command is used to locate the location of executable files, source code files, and help files in the file system. The syntax is "whereis [option parameter] [BMS directory name -f ] file name". The whereis command can only be used to search for program names, and only searches binary files (parameter "-b"), man description files (parameter "-m") and source code files (parameter "-s"); if the parameters are omitted, All information is returned.

How to use linux whereis command

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

The whereis command in Linux is used to locate the location of executable files, source code files, and help files in the file system. The attributes of these files should belong to original code, binary files, or help files.

whereis The program also has the ability to search source code, specify alternative search paths, and search for unusual items.

whereis command uses

whereis command can only be used to search for program names, and only searches for binary files (parameter -b), man Description files (parameter -m) and source code files (parameter -s). If parameters are omitted, all information is returned.

Compared with find, whereis search speed is very fast. This is because the Linux system will record all files in the system in a database file. When using whereis, the data will be searched from the database. Instead of searching by traversing the hard disk like the find command, the efficiency will naturally be very high.

However, the database file is not updated in real time. By default, it is updated once a week. Therefore, when we use whereis to search for files, we sometimes find data that has been deleted, or the file has just been created, but cannot It was found that the reason was that the database file had not been updated.

Linux whereis command detailed explanation

Function

The whereis command is used to find files.

Syntax

whereis [-bmsu] [BMS 目录名 -f ] 文件名
Copy after login

Parameters

ParametersDescription
-bLocate the executable file.
-mLocate the help file.
-sLocate source code files.
-uSearch for files other than executable files, source code files, and help files in the default path.
-BSpecifies the path to search for executable files.
-MSpecifies the path to search for help files.
-SSpecifies the path to search for source code files.

Common examples of whereis command

Find the location of the cd command

whereis cd
Copy after login

How to use linux whereis command

Find out all files related to tomcat and svn

whereis tomcat

whereis svn
Copy after login

How to use linux whereis command

Explanation: tomcat is not Installation, cannot be found, svn installation found many related files

Only binary files were found

# whereis -b svn
svn: /usr/bin/svn /usr/local/svn

# whereis -m svn
svn: /usr/share/man/man1/svn.1.gz

# whereis -s svn
svn:
Copy after login

How to use linux whereis command

Explanation: whereis -m svn finds the documentation path, and whereis -s svn finds the source file.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to use linux whereis command. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template