Detailed description of the find command in linux

Source: Internet
Author: User

Detailed description of the find command in linux
Find
Search
It is a real-time Feature and does not require a database. It is relatively slow.
1. Recursively search for files in a specified path
2. Search by various criteria
3. Support for further instructions on searched files

Syntax: # find [path] [parameter] [expression]

Common Parameters
-The user searches for files based on the file owner.

# Find/root-user root: find the file whose owner is root in the root directory

-Group: searches for files based on the group to which the files belong.

# Find/root-group root search for files whose group is root in the/root folder

-Nouser: Find files without the file owner, for example, some Trojans, but note that some linux system files have no users.

# Find/etc-nouser

-Nogroup: searches for files without groups. The principle is the same as-nouser.

# Find/etc-nogroup

-Name: search by file name

# Find/ect-name services search for a file named service under etc

-Size: searches for Objects Based on their sizes.

# Find/etc-size + 1000 k search for files larger than 1 MB

-Type: Find the file based on the file type. General files use f, character c, block file B, Directory d, link l

# Find/root-type f: find a common file of the file type

-Atime + n: files accessed or executed for more than n days

-Ctime + n files whose write and inode attributes (change owner, permission, or connection) are longer than n days

-Mtime + n: file with a write time greater than n days

-Exec outputs the find search result to the subsequent command as the input. For example.
# Find./-mtime + 10-exec rm-rf {}\; find and delete files created in the current directory for more than 10 days

In this command, {} is used as an alternative to the file found earlier. The '\' is ';' is followed by an escape character. Otherwise, shell uses a semicolon as the end of the command for this line.

-Perm searches for Objects Based on their permissions.

# Find/home-perm 600

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.