Linux notes: Search command Find,locate,which,whereis,grep

Source: Internet
Author: User

Command name: Find
Features: File Search
Command path:/bin/find
Usage: Find search scope match criteria
Other:
Example:
Find/root-name Init
Find/root-size +1024
Find/root-user Dashen
Find/root-group Yizu
Find/root-cmin-5
Find/root-size +1024-a-size-2048
Find/root-type F
Find/root-inum 1234
Find/root-name test-exec ls-l {}\;
Parameters:
-name Search by file name (exact search.) To use a fuzzy search, you can use a wildcard character: * Match 0 or more characters, match a single character)
-iname Search by file name, case insensitive
-size is found by file size (+n is greater than, n is less than, N equals.) Units are data blocks, 1 data blocks are 512 bytes, 0.5K. Data block is the smallest unit of Linux storage files)
-user Find by file owner
-group find by file-owning group
-amin find files accessed in n minutes (+n over how long,-N how long)
-cmin find files that have been modified in n minutes (+n over how long,-N, how long)
-mmin find files that have been modified in n minutes (+n over how long,-N, how long)
-A connection option, and
-O connection option, or
-type Search by file type (f file, D directory, l soft link file)
-inum based on I-node lookup
-exec command {}\; (Perform actions directly on search results.) {} indicates a substitution for search results, \ is an escape character)
-ok and-exec are similar, just need to ask

Command name: Locate
Function: Find files in the file repository
Command path:/usr/bin/locate
Usage: Locate [-I.] File name
Other: File repositories are automatically maintained on a regular basis, not in real time, and some directory files are not included. You can use UpdateDB to update the file repository.
Parameters:
-I is case insensitive

Command name: which
Function: Search the directory and alias Information of the command (only can search the command)
Command path:/usr/bin/which
Usage: which command

Command name: Whereis
Function: Search the directory where the command is located and the Help document path
Command path:/usr/bin/whereis
Usage: Whereis command

Command name: grep
Function: Search for string matching lines in the file and output
Command path:/bin/grep
Usage: grep [-iv] Specifies a string file
Parameters:
-I is case insensitive
-V excludes the specified string

Linux notes: Search command Find,locate,which,whereis,grep

Related Article

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.