Shell Find command detailed

Source: Internet
Author: User
Tags readable

Find Files
Find./-type F

Find a Directory
Find./-type D

Find a file or directory with the name test
Find./-name Test

Look for a file whose name matches the regular expression, and note the preceding '. * ' (found file with directory)
Find./-regex. *so.*\.gz

Find the directory and list the files under the directory (the LS command is executed separately for each directory found, no option-print the directory name is not displayed on the previous line of the file list)
Find./-type d-print-exec ls {} \;

Locate the directory and list the files in the directory (the LS command is executed separately for each directory found, and you need to confirm before executing the command)
Find./-type d-ok ls {} \;

Find the directory and list the files under the directory (add the found directory to the LS command one time after execution, the parameters will be executed multiple times when the parameter is too long)
Find./-type d-exec ls {} +

Find files with file names matching *.c
Find./-name \*.c

Prints the contents of the test file after printing the test filename
Find./-name test-print-exec cat {} \;

Do not print the test file name, only the contents of test files
Find./-name test-exec cat {} \;

Find files that are less than two days away from the current time of file update date
Find./-mtime-2

Files that are more than two days away from the current time when you find file update days
Find./-mtime +2

Find files that are less than two days away from the current time of day when files are updated
Find./-mtime 2

Find files that are less than two minutes from the current time when the file is updated
Find./-mmin-2

Find files that are more than two minutes from the current time when the file is updated
Find./-mmin +2

Find files that are less than two minutes away from the current time when a file is updated
Find./-mmin 2

Find file update time than file ABC content update time new file
Find./-newer ABC

Find file access times than file ABC content update time new files
Find./-anewer ABC

Find empty files or empty directories
Find./-empty

Find empty files and delete
Find./-empty-type F-print-delete

Find a file or directory with permission 644 (requires full compliance)
Find./-perm 664

Find files or directories where user/group permissions are read-write, other user rights are readable (other permissions are not limited)
Find./-perm-664

Find files or directories where the user has write permission or the group user has write permission
Find./-perm/220
Find./-perm/u+w,g+w
Find./-perm/u=w,g=w

Find directories or files with Read permission for owner permissions
Find./-perm-u=r

Find directories or files with Read permission for user group permissions
Find./-perm-g=r

Find directories or files with Read permission for other user rights
Find./-perm-o=r

Find files or directories that are owned by LZJ
Find./-user Lzj

Find a file or directory with a group named Gname
Find./-group Gname

Files that find the user ID of a file that does not exist
Find./-nouser

Find file with group ID that does not exist
Find./-nogroup

To find files with Execute permissions but no Read permission
Find./-executable \! -readable

Find file size smaller than 10 bytes of file or directory
Find./-size-10c

Find a file or directory with size equal to 10 bytes
Find./-size 10c

Find files or directories with a size greater than 10 bytes
Find./-size +10c

Find files or directories with size less than 10k
Find./-size-10k

Find files or directories with size less than 10M
Find./-size-10m

Find files or directories with size less than 10G
Find./-size-10g

Shell Find command detailed

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.