-type b/d/c/p/l/f #查是块设备、目录、字符设备、管道、符号链接、普通
文件
-size n[c] #查长度为 n 块[或 n 字节]的文件
-depth #使查找在进入子目录前先行查找完本目录
-fstype #查位于某一类型文件系统中的文件,这些文件系统类
型通常可 在
/etc/fstab 中找到
-mount #查文件时不跨越文件系统 mount 点
-follow #如果遇到符号链接文件,就跟踪链接所指的文件
-cpio %; #查位于某一类型文件系统中的文件,这些文件系统类
型通常可 在
/etc/fstab 中找到
-mount #查文件时不跨越文件系统 mount 点
-follow #如果遇到符号链接文件,就跟踪链接所指的文件
-cpio #对匹配的文件使用 cpio 命令,将他们备份到磁带设备
中
-prune #忽略某个目录
=========================================
============
$find ~ -name "*.txt" -print #在$HOME 中查.txt 文件并显示
$find . -name "*.txt" -print
$find . -name "[A-Z]*" -print #查以大写字母开头的文件
$find /etc -name "host*" -print #查以 host 开头的文件
$find . -name "[a-z][a-z][0–9][0–9].txt" -print #查以两个小写字
母和两个数字开头的
txt 文件
$find . -perm 755 -print
$find . -perm -007 -exec ls -l {} \; #查所有用户都可读写执行的文
件同
-perm 777
$find . -type d -print
$find . ! -type d -print
$find . -type l -print
$find . -size +1000000c -print #查长度大于 1Mb 的文件
$find . -size 100c -print # 查长度为 100c 的文件
$find . -size +10 -print #查长度超过期作废 10 块的文件
(
1 块=512 字节)
$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