Linux Find instance

Source: Internet
Author: User
Tags svn

Use options:
Find [Paths] < expressions > [actions]

1. Name option, find by name
Find the manage.py file in the current directory: Find. -name ' manage.py '

2, Atime/ctime/mtime option, based on time (24 hours) to find
Note: A means that access,c represents create,m modify
Find files created within 24 hours: find. -ctime-1
Find files created 24 hours ago: Find. -ctime 1
Note: Atime and Mtime use consistent

3.amin/cmin/mmin option, search by Time
Find files created within 10 minutes: find. -cmin-10
Find files created 10 minutes ago: Find. -cmin 10
Note: Amin and Mmin use consistent

4, Anewer/cnewer/mnewer, find a new file than a file
Find files that have been accessed after hello.py: Find. -anewer hello.py

5. User
Find files belonging to a user: find. -user The5fire

6. Type
Find all files: Find. -type F
Find all directories containing the demo directory: find. -type d-name ' *demo* '

7, exec, is said to be very powerful parameters
Locate the ' setup.py ' file, and then open: Find. -name ' setup.py '-exec vim {} \;
Another most commonly used, force delete all. svn file directories below the item, find. -name '. SVN '-exec rm-rf {} \;

8, empty
Displays all the blank files and displays the details: find. -empty-ls #加ls完全画蛇添足, just to illustrate this parameter.

9. Size
Display files of size 10k: Find. -size 10k
Show all files larger than 10k: find. -size +10k
Show all files less than 10k: find.-size-10k

10, or, and, not, or, and, non-query
Find files that are larger than 10k or contain a demo: Find. -size +10k-o-name ' *demo* '
Find files that are larger than 10k and less than 100k: find. -size +10k-a-size-100k
Find files larger than 10k with a name that does not contain a demo: Find. -size +10k! -name ' *demo* '

11, Perm, based on file permissions to find
Note: If you find a file with permission 600: Find. -perm 600, if the permission is preceded by a "-" number, indicating that a match can be satisfied,
such as: Find. -perm 007 matches files with permissions of 007, 077, 777

12, regex, use regular expressions to find
such as: Find. -regex '. */[0-9]\w.* ' (matches a file that starts with a number)

13,-maxdepth, limit directory depth search
Find all the py files in the first level directory: Find. -name ' *.py '-maxdepth 1

After entering Find-help, there are still many, not one by one columns, which should be able to meet the daily needs. Welcome to Supplement ^_^

Linux Find instance

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.