3 Find commands for Linux

Source: Internet
Author: User

There are many commands in Linux to see the path of a file, and here is a little summary.

1, Find command

The find command should be the most familiar when it comes to finding commands, and is also the most powerful find command in Linux. It can find any file you want in the specified directory. How to use:

Find < Specify directory > < specify conditions > < specify Actions >

If any of the parameters do not indicate a search for the current directory and its subdirectories, no results are filtered and they are displayed on the screen. Examples of Use:

Find. -name test means searching for a file named Test in the current directory

find/home/xiang-amin-2 Find files that have been accessed in the last two minutes under the specified directory

There is a lot more to be specified about find, which can be seen in detail.

The essence of 2,locate is find-name, but locate's execution efficiency is much faster than the Find command, because its search is not directory-based, but to search/var/lib/locatedb this database file. In order to prevent too many files listed, the general and GREP commands work together to locate files in a specific directory. The Linux system automatically creates this file and updates it automatically. To avoid searching for newly created files, it is a good idea to run the UpdateDB command before using it. Usage of Locate:

Find < file name >

Use example: Locate test finds all the files that begin with test.

3,whereis

This command can only be used for binary files, man file and source code file search,-B for Search binary executable,-M for man file,-s for source file

Whereis pwd location of all PWD files

In addition, which and type also have the ability to search for files in some cases, because they are not often used in practice and are not described here.

3 Find commands for Linux

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.