find

一、命令格式

  find [option]  查找范围  查找条件  处理动作

    1.目标范围:一般为目录

    2.查找条件:

      -name:  按照文件名字寻找

      -size:  按照文件大小来寻找

      -type:  按照文件类型来寻找

        f:普文件

        d:目录

      -user:  按照文件属主寻找

      -group:  按照文件属组寻找

      -perm:  按照文件权限寻找

      -atime/mtime/ctime:按照文件创建/访问/修改时间寻找

    3.处理动作(默认输出到屏幕)

      1.-print:打印到标准输出上

      2.-ls  :以长格式输出详细信息

      3. -exec command :执行命令(command)

        find / -name 123 -exec  mv {}  {}w ; 

         找到/下名为123的文件改名加一个w。(注意{}为占位符,在{}前后需要有空格)

      4.xages command

        find / -name 123 | xargs  chmod +w

          找到/下名为123的文件增加w权限。

      

原文地址:https://www.cnblogs.com/kevinzr/p/12659952.html