Linux system to search for files with whereis command.

Source: Internet
Author: User
Tags svn tomcat

Linux under the Whereis command and find command a bit similar, Whereis command lookup faster, but can only find the program name, with the following small series to understand the specific use of the Whereis command.

The Whereis command searches only binaries (parameter-B), man description files (parameter-m), and source code files (parameter-s). 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 examples:

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.

Above is the use of Linux under the Whereis command, whereis command search conditions are relatively limited, if you only search program name, use Whereis command is very fast.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.