Use the find command to find files

Source: Internet
Author: User

Unix/Linux use the find command to find files

Find an empty directory:
Find/path-depth-type D-empty

Search for empty files:
Find/path-depth-type F-empty

Search for files by name:
Find/path-name name_of_file

Search for files by extension:
Find/path-name "*. given_extension"

Search for files with specific permissions and extensions:
Find/path-name '*. txt'-Perm 644

Find a file based on the permission attributes of the file:
Find/path-Perm-permision_bits

I don't know the extension. I only use the file name to find the file:
Find/path-name 'giveen _ name .*'

Search for files modified within 24 hours:
Find/path-mtime n
Here, N, 0 represents 24 hours, 1 represents 48 hours, and 2 represents 72 hours. The same is true for N below.

Find the files in the last 24 hours:
Find-atime n

Search for files by owner:
Find/path-User Root

Find and delete files:
Find/path-name mytestfile | xargs RM

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.