"Find" personal use of the method to record

Source: Internet
Author: User

Find is profound, I have not in addition to simple usage, other in the work has not been deeply studied.

Another, attach several blog articles, follow up may update this list:

    1. Linux File Lookup command Find,xargs details http://boyun.sh.cn/bio/?p=773

Use up to 2, find files of the specified type, print and delete:find ${d_bak_log} -type f -name  "*.log"  -mtime +${s _copies} -printfind ${d_bak_log} -type f -name  "*.log"  -mtime +${s_ Copies} -delete find the empty directory Find /path -depth -type d -empty find the file with byte 0 Find /path  -depth -type f -empty find specific file name files Find /path -name name_of_file find files for specific extensions find  /path -name  "*.given_extension" Find File find /path -name  ' *.txt '  -based on permissions and specified extension perm 644 Find the file find /path -perm -permision_bits (permission bit) for the specified permission to find the specified file name (files of any extension) Find /path  -name  ' given_name.* ' files changed in the last 10 minutes: find /home/web/log/exportlog -type f -mmin  -10 -exec ls -l {} \;find based on the time to find a minus-to limit the change time within the current n days of the file, and with the Plus + to limit the change time before the N-day file. Each parameter description-amin n find the last n minutes of access to the file in the system-atime n find the last n*24 hour Access file in the system-cmin n find files in the system that last n minutes were changed file status-ctime  N Find the file-mmin  the last n*24 hour of the system changed file statusN Find the file in the last n minutes of the system changed file data-mtime n find the last n*24 hours in the system file changed file data time within 5th files find /path -mtime - 5 finding and deleting files find /path -name  "core.*"  -type f -print | xargs /bin/rm  -f to find the extension find /path -type f | xargs rename .baksh  ". Sh" after specifying the extension name Find the garbled file name and delete the example 1:[[email protected] download]# ls -li134742021 -rw-r--r--    1 root     root        0 feb  17 17:28 ?? p?134754342 -rw-r--r--   1 root     root      3.8m mar 28  2012 xtrabackup-1.6.6-332.rhel6.x86_64.rpm134742018 - rw-r--r--   1 root     root         0 feb 17 17:28 ?x,u[[email protected] download]# find .  -Inum 134742021./?? P? [[email protected] download]# find . -inum 134742021 -exec rm {}  \; [[email protected] download]# ls?x,u  xtrabackup-1.6.6-332.rhel6.x86_64.rpm Example 2:[[ Email protected] download]#  ll -hi25953325 -rw-rw-r--  1 root  root  63m may 30  2012 --exclude[[email protected] download ]#  find . -inum 25953325 -print./--exclude[[email protected] download ]#  find . -inum 25953325 -delete Example 3:[[email protected] ~]$ ls  -I916302&NBSP, tire? [?? D? G?go?e]? Hk? I?? _??? X????? -?q??? [[email protected] ~]$ find -inum 916302 -print ./Tire?] [?? D? G?go?e]? Hk? I?? _??? X????? -?q??? [[email protected] ~]$ find -inum 916302 -delete[[email protected] ~]$  ls


"Find" personal use of the method to record

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.