Search files under linux command whereis/which/find/locate

Source: Internet
Author: User

1.whereis

Whereis who

whereiscan only search binaries (-B), man Help file (-m) and source code file (-s)

2.locate

So sometimes when you just add a file, it may not be found and requires a command to be executed manually updatedb

(This command must be executed first in our environment). It can be used to find different file types under the specified directory,

To find all files starting with SH in/etc:

$ locate/etc/sh

Note that it is not just looking in the/etc directory, but also automatically recursively looking for subdirectories.

$ Locate /usr/share/\*.jpg Note that you want to escape the backslash * before adding the number , otherwise you will not find

3.which

whichitself is a shell built-in command that we typically use which to determine if a specified software is installed

Because it only PATH searches for the command from the path specified by the environment variable:

4.find

Should be the most powerful of these commands, not only through the file type,

File names and can be searched based on the attributes of the files (such as file timestamps, file permissions, etc.)

$ sudo find /etc/-name interfaces

Note the path to the Find command is the first parameter , and the basic command format is find [path] [option] [action].

Search files under linux command whereis/which/find/locate

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.