Linux File Search command

Source: Internet
Author: User

1, which

function: Show command of System command

Syntax: which command name

Example: Which LS

2. Find

Function: Find files or directories

Syntax: Find [Search path] [search keywords]

Example:

Find/etc -name init find file named init, exact match

Find/etc-name init*

Find/etc-name Init???

* matches any character, containing 0 or more characters

? Match a single character

Find/etc-size +204800 find file size greater than 100mb,204800 is the number of data blocks, 1 data block size is 512B

find/etc-size-204800 find file size less than 100mb,204800 is the number of data blocks, 1 data block size of 512B

Find/etc-user user name find files in directory under File owner as "user name"

CTime, Atime, Mtime time per day

Cmin, Amin, mmin time in minutes

C: Changed the properties of the file has been modified, owner, owning group, permission

A: Access file has been accessed

M: The contents of the modified file have been modified

FIND/ETC-CTIME-1 documents changed within 1 days

Find/etc-ctime +1 files changed in more than 1 days

find/etc-mmin-120 files that have been modified within 120 minutes

(1) Connector:-a logic with;-o logic or, multiple find criteria

Find/etc-size 204800-a-size-409600

-type File types

F Binary Files

L Soft Link File

Catalog D

(2) connector-exec

Find ...-exec command {} \; Fixed format, cannot be changed

{} Represents the result of a find query;

\ is an escape character;

; Represents a terminator.

Example: Find. -name init-exec ls-l {} \;

Instead of-exec, switch to-OK and ask if the command is executed.

Inode for-num files

Find. -num 16 Looking for a file with Inode 16 in the current directory

3, locate

Function: Find files or directories

Syntax: Locate keyword

4, UpdateDB

Function: Establish the whole system file directory database

5. grep

Function: Find the line of keyword matching within the file and output

Syntax: grep keyword path


6, man

Features: Get help information

Syntax: Man command name

7 、--Help

Features: View information about the parameters of a command

Syntax: Command--help

Linux File Search command

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.