Linux under Find command instance

Source: Internet
Author: User
Tags print print

Linux under Find command instance

$find ~-name "*.txt"-print #在 $HOME to check the. txt file and display the
$find.   -name "*.txt"-print
$find.   -name "[a-z]*"-PRI26NBSP;   #对匹配的文件使用cpio命令, back them up to the

tape device-prune #忽略某个目录
$find.  -name "[a-z]*"-print #查以大写字母开头的文件
$find/etc-name "host*"-print #查以host开头的文件
$find.  -name "[A-z][a-z][0--9][0--9].txt"-print the

txt file that begins with #查以两个小写字母和两个数 word
$find.  -perm 755-print
$find.  -perm-007-exec ls-l {};  #查所有用户都可读写执行的文件同-perm 777
$find.-type d-print Print directory structure
$find.  ! -type d-print Print Non-directory files
find/usr/include-name ' *.h '-exec grep af_inef6 {};

Because grep can't recursively search subdirectories, it can be used in conjunction with find. Find strings in the. h file in all/usr/include subdirectories Af_inef6

$find.  -type l-print $find.  -size +1000000c-print #查长度大于1Mb的文件 $find.  -size 100c-print # Check the 100c file $find. -size +10-print #查长度超过期作废10块的文件 (1 block = 512 bytes) $CD/$find etc Home Apps-depth-print |  Cpio-ivcdc65536-o/dev/rmt0 $find/etc-name "passwd*"-exec grep "Cnscn" {}; #看是否存在cnscn用户 $find. -name "yao*" | Xargs file $find.  -name "yao*" | Xargs echo "" >/tmp/core.log $find. -name "yao*" | Xargs chmod o-w find-name april* The current directory to find files starting with April Find-name april* file is found in the current directory with Fprint start file, and output the results to file Find-name ap*-o-name may* Find files that start with AP or May find/mnt-name Tom.txt-ftype vfat Find the name/mnt under Tom.txt And the file system type is VFAT file Find/mnt-name t.txt! -ftype VFAT under/mnt look for files whose name is tom.txt and file system type is VFAT find/tmp-name wa* l look for files named WA beginning with type symbolic link in/tmp-type         Me-mtime-2/home The files that were changed in the last two days find/home-atime-1 check the files that were accessed within 1 days find/home-mmin +60 Check the files that were changed 60 minutes before the/home find/home-amin +30 check the files accessed in the last 30 minutes find/home-newer Tmp.txt/home The XT near file or directory Find/home-anewer tmp.txt/home under the file or directory find/home-used-2 near tmp.txt files or directories are changed after the file or directory has been modified, on 2nd Files or directories accessed within the/home directory Find/home-user CNSCN lists the files or directories that belong to the user CNSCN within the directories find/home-uid +501 lists the user's identification code in the/home directory Files or directories that are greater than 501 Find/home-group CNSCN list files or directories that are CNSCN in the/home group Find/home-gid 501 list files or targets with a group ID of 501 in/home   Record Find/home-nouser lists files or directories within/home that are not local users find/home-nogroup lists files or directories within/home that are not part of the local group Find/home -name tmp.txt-maxdepth 4 lists the tmp.txt in/home at up to 3 levels Find/home-name Tmp.txt-mindepth 3 from the 2nd floor FIND/HOME-E Mpty find files of size 0 or empty directories find/home-size +512k files larger than 512k find/home-size-512k check files less than 512k fi Nd/home-links +2 Check the number of hard connections more than 2 files or directories Find/home-perm 0700 Check permissions 700 files or directories Find/tmp-name TMP.TXT-E
Xec Cat {}; Find/tmp -name Tmp.txt-ok rm {}; Find/-amin-10 # finds files accessed in the last 10 minutes of the system find/-atime-2 # finds files accessed in the last 48 hours of the system find/-empty # Search in Department A file or folder that is empty in the system find/-group Cat # Look for files that belong to the Groupcat file found/-mmin-5 # Find files that have been modified in the last 5 minutes of the system found/-MTI Me-1 #查找在系统中最后24小时里修改过的文件 Find/-nouser #查找在系统中属于作废用户的文件 Find/-user Fred #查找在系统中属于FRED这个用户的文件

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.