find命令

  • 语法格式
find [path] [options] [tests] [actions]
  • options
  -depth     Process each directory's contents before the directory itself.  
  -follow   跟随链接符号
  -maxdepths     最多搜索N层目录
  -mount     不搜索其他文件系统中到目录
  • tests
  -name  pattern     文件名匹配正则模式pattern,pattern尽量用引号  
  -newer  otherfile     比otherfile新
  -type f   文件类型是普通文件,可以为d(目录文件)和c(特殊类型)  
  -user username   文件属于username

    组合测试需要用括号,例: find / \( -name "test*" -or -newer afile \) -type f -print

  • actions
  -exec  command     执行命令  
  -ok  command   执行命令,需要确认
  -print   打印文件名
  -ls   执行ls -dils

 

 

 

 

posted @ 2012-07-10 20:23  kimiz  阅读(130)  评论(0)    收藏  举报