一、主要内容

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

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. 【leetcode】1029. Two City Scheduling

    题目如下: There are 2N people a company is planning to interview. The cost of flying the i-th person to ...

  2. Task6.神经网络基础

    BP: 正向计算loss,反向传播梯度. 计算梯度时,从输出端开始,前一层的梯度等于activation' *(与之相连的后一层的神经元梯度乘上权重的和). import torch from tor ...

  3. Counter的数据统计功能

    Counter是dict的子类,一般用于统计,默认排序是从大到小 from collections import Counter # 输入iterable对象即可 str_counter = Coun ...

  4. 【2019 Multi-University Training Contest 8】

    01: 02: 03:https://www.cnblogs.com/myx12345/p/11655876.html 04: 05: 06:https://www.cnblogs.com/myx12 ...

  5. c#image与byte数组的转换

    // image to byte[] Image photo = new Bitmap(selectPictureFile); System.IO.MemoryStream ms = new Syst ...

  6. Prefix

    Prefix 南昌邀请赛的题,字典树 #include<bits/stdc++.h> using namespace std; typedef long long ll; ll A[]; ...

  7. HttpClient配置及示例代码

    HttpComponents是Apache 旗下的项目.其中有一个HttpClient,即HTTP客户端. ... ... 大多时候我们只需要HttpClient,httpCore是开发服务端的我们可 ...

  8. 牛客2019提高D1t1 最短路

    分析 我们发现可以按照ai从小到大排序 边的大小就是当前的a减去前面第一个不等于它的a 代码 #include<iostream> #include<cstdio> #incl ...

  9. 穿戴-智能穿戴-ProjectGlass:谷歌眼镜(Google Project Glass)

    ylbtech-穿戴-智能穿戴-ProjectGlass:谷歌眼镜(Google Project Glass) 谷歌眼镜(Google Project Glass)是由谷歌公司于2012年4月发布的一 ...

  10. docker 搭建gitlab

    https://docs.gitlab.com/omnibus/docker/ https://blog.csdn.net/m0_37444820/article/details/81147452 h ...