linux下find查找命令用法

2020-01-30 12:30:43王旭

命令:

find . -type d | sort

输出:


复制代码
[root@localhost test]# find . -type d | sort
.
./scf
./scf/bin
./scf/doc
./scf/lib
./scf/service
./scf/service/deploy
./scf/service/deploy/info
./scf/service/deploy/product
./test3
./test4
./test5
./test5/test3
[root@localhost test]#

实例6:按大小查找文件

命令:

find . -size +1000c -print

输出:


复制代码
[root@localhost test]# find . -size +1000c -print
.
./test4
./scf
./scf/lib
./scf/service
./scf/service/deploy
./scf/service/deploy/product
./scf/service/deploy/info
./scf/doc
./scf/bin
./log2012.log
./test5
./test5/test3
./test3
[root@localhost test]#

说明:

查找当前目录大于1K的文件

一、Linux中find常见用法示例

·find    path    -option    [    -print ]    [ -exec    -ok    command ]    {} ;
#-print 将查找到的文件输出到标准输出
#-exec    command    {} ;       -----将查到的文件执行command操作,{} 和 ;之间有空格
#-ok 和-exec相同,只不过在操作前要询用户 ==================================================== -name    filename               #查找名为filename的文件
-perm                         #按执行权限来查找
-user     username              #按文件属主来查找
-group groupname              #按组来查找
-mtime    -n +n                 #按文件更改时间来查找文件,-n指n天以内,+n指n天以前
-atime     -n +n                #按文件访问时间来查GIN: 0px">-perm                          #按执行权限来查找
-user     username              #按文件属主来查找
-group groupname              #按组来查找
-mtime    -n +n                 #按文件更改时间来查找文件,-n指n天以内,+n指n天以前