Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the whereis command in Linux to quickly find files only by program name

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Linux how to use the whereis command to quickly find files in the program name", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "how to use the whereis command in Linux to quickly find files only program name" bar!

The whereis command searches only binaries (parameter-b), man description files (parameter-m), and source code files (parameter-s). If the parameter is omitted, all information is returned.

Compared with find, whereis search is very fast, this is because the linux system will record all the files in the system in a database file, when using whereis and the following locate, it will look for data from the database, instead of traversing the hard disk to find, as the find command does, it will naturally be very efficient.

However, the database file is not updated in real time, and by default it is updated once a week, so when we look for files with whereis and locate, we sometimes find the data that has been deleted, or the file has just been created, but cannot find it, because the database file has not been updated.

1. Command format:

Whereis [- bmsu] [BMS directory name-f] file name

2. Command function:

The whereis command locates 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, binaries, or help files. Whereis programs also have the ability to search source code, specify alternate search paths, and search for unusual items.

3. Command parameters:

-b locate the executable file.

-m locate the help file.

-s locate the source code file.

-u search for files under the default path other than executable files, source code files, and help files.

-B specifies the path to search for executable files.

-M specifies the path to search for help files.

-S specifies the path to search for source code files.

4. Use an example:

Example 1: find out all the 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 was not installed and could not be found. Svn installation found a lot of related files.

Example 2: only look up the binaries

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 finds the path to the instruction document, and whereis-s svn looks for the source source file.

Thank you for your reading, the above is the content of "how to use the whereis command in Linux to quickly find the file name only". After the study of this article, I believe you have a deeper understanding of how to use the whereis command to quickly find the file name in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report