The Find command in Linux

Source: Internet
Author: User

Find

Find is the most common and powerful find command, finding a file on disk, using it to find any file you're looking for, which is a bit slow.

Find Path-option [-print] [-exec-ok command] {} \;

Path is the file, option is the parameter, [] the content is optional;

#-print output of the found file to standard output
#-exec command {} \; The command operation-----The file to be traced, with a space between {} and \;
#-ok and-exec are the same, except to consult the user before operation

Find command parameters:

-name filename #查找名为filename的文件

-perm #按执行权限来查找

-user username #按文件属主来查找

-group GroupName #按组来查找

Find by Size:

Find/-size 1500c (look for a 1,500-byte file, c for bytes)
Find/-size +1500c (finds files larger than 1,500 bytes, + represents greater than)
Find/-size-1500c (finds files less than 1,500 bytes in size-Indicates less than )

Search by Time:

In the Linux operating system, each file has a lot of time parameters, of which three are compared to the main, respectively, Ctime,atime,mtime

Modification Time (mtime):

When you modify the content data of the file, it will update the time, and change the permissions or properties, Mtime will not change, this is the difference with CTime

-mtime-n +n #按文件更改时间来查找文件,-n means n days or less, +n means n days ago

Status Time (CTime)

This time is updated only if the properties or permissions of the file are updated, and the time is not updated when the content is changed.

 -ctime-n +n #按文件创建时间来查找文件,-n means n days or less, +n means n days ago

  

  

Accesstime (Atime)

Atime: Access time, which is the time at which the file was last read

-atime-n +n #按文件访问时间来查文件,-n means n days or less, +n means n days ago

  

The Find command in 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.