Leeboy's Linux Study II

Source: Internet
Author: User
Tags uppercase letter

10. Find pathname-options [-print-Exec-OK]
1) to search for all '*. txt' files in the current directory and subdirectory, you can use: find.-Name "*. txt"-print
2), to the current directory and subdirectory to find the file name starting with an uppercase letter, you can use: find.-Name "[A-Z] *"-print
3) search by permission: find.-Perm 755-print
4) Ignore directory./leeboy: find.-path "./leeboy"-prune-o-name "*. cpp"-print (-O indicates or)
5) Ignore multiple directories. /leeboy ,. /LEE: Find. \ (-path. /leeboy-o-path. /LEE \)-prune-o-name "*. CPP "-print (-O indicates or)
6) Search for files with leeboy as the owner./folder: Find./-user leeboy-print
7) find.-mtime-1-print files within one day
8) to find files whose modification time is earlier than 2 days, you can use: find.-mtime + 2-print.
9) Search for files newer than FTW. C and older than remove. C, that is, files between FTW. C and remove. C: find.-newer FTW. C! -Newer remove. C-print
(The file time can be controlled through touch: Touch-T 08151056 leeboy time is set to August 15 10:56)
10) search by type: find.-type D-print folder type
11) files smaller than 10 bytes by file size: Find-size-10C-print. More than 10 files, one 512 bytes: find.-size + 10-print
12) execute the shell command on the found file: find.-newer rename. C! -Newer Unlink. cpp-exec LS-l {}\; the LS-l command is executed. (Only valid for files)
13) search in the search results # Include Specific field find.-Name "*. cpp"-print | xargs grep "# include ". Xargs efficiency is higher than-Exec: find.-Name "*. cpp"-exec grep "# include "{}\;

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.