一、主要内容

======================================

1. 用文件名查找文件

2.用文件名查找文件,忽略大小写

3. 使用mindepth和maxdepth限定搜索指定目录的深度

4. 在find命令查找到的文件上执行命令

5. 相反匹配

6. 使用inode编号查找文件

7. 根据文件权限查找文件

8. 找到home目录及子目录下所有的空文件(0字节文件)

9. 查找5个最大的文件

10. 查找5个最小的文件

11. 使用-type查找指定文件类型的文件

12. 通过和其他文件比较修改时间查找文件

13. 通过文件大小查找文件

14. 给常用find操作取别名

15. 用find命令删除大型打包文件

16.找到在1个小时内被更改的文件

17.找到1个小时内被访问过的文件

18.查找一个小时内状态被改变的文件

19.搜索仅仅限定于文件,不显示文件夹

20.仅仅查找非隐藏的文件(不显示隐藏文件)

21.查找文件修改时间在某一文件修改后的文件

22.查找文件访问时间在某一文件的修改时间之后的文件

23.查找状态改变时间在某个文件修改时间之后的文件:

24.在find命令输出上使用 ls -l,列举出1小时内被编辑过的文件的详细信息

25.仅仅在当前文件系统中搜索

26.在同一个命令中使用多个{}

27. 使用多个{}实例

28.将错误重定向到/dev/nul

29.将文件名中的空格换成下划线

30.在find结果中同时执行两条命令

31、常用指令

======================================

二、find命令实用实例总结

======================================

一、基于name查询文件

# find . -name tecmint.txt

# find /home -name tecmint.txt

# find /home -iname tecmint.txt

# find / -type d -name Tecmint

# find . -type f -name tecmint.php

# find . -type f -name "*.php"

二、基于权限查询文件

# find . -type f -perm 0777 -print

# find / -type f ! -perm 777

# find / -perm 2644

# find / -perm 1551

# find / -perm /u=s

# find / -perm /g+s

# find / -perm /u=r

# find / -perm /a=x

# find / -type f -perm 0777 -print -exec chmod 644 {};

# find / -type d -perm 777 -print -exec chmod 755 {};

# find . -type f -name "tecmint.txt" -execrm -f {} ;

# find . -type f -name "*.txt" -exec rm -f{} ;

# find . -type f -name "*.mp3" -exec rm -f{} ;

# find /tmp -type f -empty

# find /tmp -type d -empty

# find /tmp -type f -name ".*"

三、基于用户和组查询文件

# find / -user root -name tecmint.txt

# find /home -user tecmint

# find /home -group developer

# find /home -user tecmint -iname "*.txt"

四、基于时间查询文件或目录

# find / -mtime 50         它代表着最近一次文件内容被修改的时间。可用ls -l 命令查看

# find / -atime 50

  1.   将分区mount的挂载的时候指定采用非relatime方式
  2.   atime小于ctime或者小于mtime的时候
  3.   本次的access time和上次的atime超过24个小时

#find / ctime 50              它代表着最近一次文件状态改变的时间 ,是status change time,是在写入文件、更改所有者、权限或链接设置时随 Inode 的内容更改而更改,即文件状态最后一次被改变的时间。可用ls -lc 命令查看。

# find / -mtime +50 –mtime -100

# find / -cmin -60

# find / -mmin -60

# find / -amin -60

五、基于大小查询文件或目录

# find / -size 50M

# find / -size +50M -size -100M

# find / -size +100M -exec rm -rf {} ;

# find / -type f -name *.mp3 -size +10M -exec rm {} ;

========================================

find命令使用详解的更多相关文章

  1. Linux 执行文件查找命令 which 详解

    某个文件不知道放在哪里了,通常可以使用下面的一些命令来查找: which  查看可执行文件的位置 whereis 查看文件的位置 locate   配合数据库查看文件位置 find   实际搜寻硬盘查 ...

  2. systemctl命令用法详解

    systemctl命令用法详解系统环境:Fedora 16binpath:/bin/systemctlpackage:systemd-units systemctl enable httpd.serv ...

  3. 批处理中的echo命令图文详解

    批处理中的echo命令图文详解 1. Echo 显示当前ECHO的状态:ECHO ON 或者ECHO OFF 2. ECHO ON 将ECHO状态设置为ON,将显示命令行,也就是前面的C:\>类 ...

  4. Ubuntu kill命令用法详解

    转自:Ubuntu kill命令用法详解 1. kill   作用:根据进程号杀死进程   用法: kill [信号代码] 进程ID   root@fcola:/# ps -ef | grep sen ...

  5. install 命令用法详解

    install 命令用法详解 http://man.linuxde.net/install install命令的作用是安装或升级软件或备份数据,它的使用权限是所有用户.install命令和cp命令类似 ...

  6. dd命令使用详解

    dd命令使用详解 http://www.cnblogs.com/qq78292959/archive/2012/02/23/2364760.html 1.命令简介 dd 的主要选项: 指定数字的地方若 ...

  7. Mysql导入导出工具Mysqldump和Source命令用法详解

    Mysql本身提供了命令行导出工具Mysqldump和Mysql Source导入命令进行SQL数据导入导出工作,通过Mysql命令行导出工具Mysqldump命令能够将Mysql数据导出为文本格式( ...

  8. Mysql数据库导入命令Source详解

    Mysql数据库导入命令Source详解 几个常用用例: 1.导出整个数据库 mysqldump -u 用户名 -p 数据库名 > 导出的文件名 mysqldump -u root -p dat ...

  9. dos下的edit命令使用详解

    dos下的edit命令使用详解 来源:网络 作者:未知 edit命令是一个简单的编辑软件,我们经常用它来编辑一些程序和批处理文件. 比如,我想在c盘根目录下编辑一个简单的批处理文件,要求无论当前盘和当 ...

  10. [转]Mysql导入导出工具Mysqldump和Source命令用法详解

    Mysql本身提供了命令行导出工具Mysqldump和Mysql Source导入命令进行SQL数据导入导出工作,通过Mysql命令行导出工具Mysqldump命令能够将Mysql数据导出为文本格式( ...

随机推荐

  1. Java中的栈和队列

    栈: public class Stack<E> extends Vector<E> { // 使用数组实现栈 // 构造一个空栈 public Stack() { } // ...

  2. 2017ICPC沈阳网络赛 HDU 6205 -- card card card(最大子段和)

    card card card Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  3. layoutSubviews 详解

    ios layout机制相关方法 - (CGSize)sizeThatFits:(CGSize)size - (void)sizeToFit ------- - (void)layoutSubview ...

  4. JS replace方法

    var str = '1abc2defg3hijk'; str.replace(/\d/g,function(a,b,c,d){ console.log("a:",a);// 匹配 ...

  5. Codeforces D. Array Division

    题目链接:http://codeforces.com/contest/808/problem/D 题意: 这一题给你一个数组,你可以调换某一个数的位置,使得这个数组可以分成2半,前半段的和等于后半段( ...

  6. GIS网站收藏

    igismap: https://www.igismap.com/ 高德WebAPI: https://lbs.amap.com/api/javascript-api/example/other-ga ...

  7. php函数名前添加& 函数的引用返回

    function &test(){ static $b=0; $b= $b+1; return $b; } $a= test(); echo $a,"\n"; $a = 3 ...

  8. 为什么从pycharm中打开的html文件会显示404?

    问题如图: 解决办法: 某次发现运行导入的html文件的时候,打开浏览器会报404错误:而运行自己写的html文件则正常显示:最后发现这是pycharm缓存问题,只需重启pycharm清除缓存就ok啦 ...

  9. storm集群搭建和java应用

    1. vim /etc/hosts ssh免密登录192.168.132.154 c0192.168.132.156 c1192.168.132.155 c2 storm集群:192.168.132. ...

  10. _exit和exit的区别

    在linux的标准库函数中,有一套称作高级I/O的函数,我们熟知的printf .fopen .fread .fwrite都在此列,他们也被称作缓冲I/O.其特征是对应每一个打开的文件,都存在一个缓冲 ...