Linux下的查找技巧
Find知识点:
-mtime ——修改时间
-ctime ——创建时间
-atime ——访问时间
mtime 举例说明:
-mtime n : n为数字,意思为在n天之前的“一天之内”被更改过内容的文件
-mtime +n : 列出在n天之前(不含n天本身)被更改过内容的文件名
-mtime -n : 列出在n天之内(含n天本身)被更改过内容的文件名
例如:将系统24小时内更改过内容的档案列出 。
find / -mtime 0
1、查找大于100M的文件
$find . -type f -size +1000000k
2、Linux查找快速增长的文件(查找近期变动的大小超过M的文件)
问题描述:发现Linux的/目录空间报警,然后登录到服务器上通过df -h 查看到/空间的可用在不断的减少,肯定是有文件在不断的占用空间。
排查脚本:查询大于1M的当日改变的文件
[oracle@swnode2 app]$ du -sh `find ./ -ctime ` | grep [-]M | sort -n 977M ./oracle/admin/gnnt/adump 959M ./grid/diag/tnslsnr/swnode2/asmnet1lsnr_asm/alert 659M ./grid/crsdata/swnode2/acfs 531M ./grid/diag/tnslsnr/swnode2/asmnet1lsnr_asm/trace/asmnet1lsnr_asm.log 498M ./oracle/diag/rdbms/gnnt/gnnt2/trace 297M ./grid/diag/apx/+apx/+APX2/trace 275M ./grid/diag/asm/+asm/+ASM2/trace 163M ./grid/diagsnap/swnode2 162M ./grid/crsdata/swnode2/cvu/cvutrc 144M ./oracle/admin/gnnt/adump/6900B0297CC66549E053650DA8C0B038 97M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/trace 92M .//grid/crf/db/swnode2/proc 51M ./grid/diag/crs/swnode2/crs/trace/ocssd_76.trc 36M ./grid/diag/tnslsnr/swnode2/listener/trace/listener.log 33M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_mmon_27452.trc 32M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_gen0_27237.trc 32M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/-MGMTDB_mmon_42907.trc 32M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/-MGMTDB_gen0_42706.trc 30M ./grid/diag/tnslsnr/swnode2/listener_scan1/trace/listener_scan1.log 29M ./grid/diag/asm/+asm/+ASM2/trace/+ASM2_gen0_7361.trc 28M ./grid/diag/asm/+asm/+ASM2/trace/+ASM2_mmon_7475.trc 28M ./grid/diag/apx/+apx/+APX2/trace/+APX2_gen0_7836.trc 26M ./grid/diag/crs/swnode2/crs/trace/osysmond_13.trc 26M ./grid/crsdata/swnode2/cvu/cvutrc/cvutrace.log. 26M ./grid/crsdata/swnode2/cvu/cvutrc/cvutrace.log. 26M ./grid/crsdata/swnode2/cvu/cvutrc/cvutrace.log. 24M ./grid/diag/crs/swnode2/crs/trace/crsd_oraagent_grid.trc 23M ./grid/crsdata/swnode2/cvu/cvutrc/cvuhelper.log. 22M ./grid/diag/crs/swnode2/crs/trace/ohasd_oraagent_grid.trc 22M ./grid/diag/crs/swnode2/crs/trace/gpnpd.trc 22M ./grid/diag/crs/swnode2/crs/trace/gipcd.trc 20M ./grid/crsdata/swnode2/cvu/cvulog 19M ./grid/diag/clients/user_grid/host_4152456498_107/trace 18M ./grid/diag/crs/swnode2/crs/trace/ohasd_orarootagent_root.trc 16M ./grid/diag/crs/swnode2/crs/trace/crsd_scriptagent_grid.trc 16M ./grid/crsdata/swnode2/acfs/acfs.log. 15M ./grid/diag/tnslsnr/swnode2/mgmtlsnr/trace/mgmtlsnr.log 15M ./grid/diag/crs/swnode2/crs/trace/octssd.trc 15M ./grid/crsdata/swnode2/cvu/cvutrc/cvutrace.log. 14M ./oracle/diag/rdbms/gnnt/gnnt2/incident 12M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_lmhb_27353.trc 12M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_dia0_27310_base_1.trc 12M ./grid/diag/crs/swnode2/crs/trace/ologgerd.trc 12M ./grid/crsdata/swnode2/acfs/advm.bin. 11M ./grid/diag/tnslsnr/swnode2/asmnet1lsnr_asm/alert/log_95.xml 11M ./grid/diag/crs/swnode2/crs/trace/ohasd.trc 11M ./grid/diag/asm/+asm/+ASM2/trace/+ASM2_lmhb_7425.trc 11M .//grid/crf/db/swnode2/proc/procdump.l01 10M .//grid/crf/db/swnode2/proc/procdump.l08 10M .//grid/crf/db/swnode2/proc/procdump.l07 10M .//grid/crf/db/swnode2/proc/procdump.l04 10M .//grid/crf/db/swnode2/proc/procdump.l03 10M .//grid/crf/db/swnode2/proc/procdump.l02 /grid/crf/db/swnode2/proc/procdump.l09 /grid/crf/db/swnode2/proc/procdump.l06 /grid/crf/db/swnode2/proc/procdump.l05 /grid/rdbms/audit/+ASM2_ora_51680_20180705000128420057143795.aud 9.7M ./oracle/diag/rdbms/gnnt/gnnt2/incident/incdir_2520377 9.7M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/alert/log.xml 9.6M ./grid/diag/crs/swnode2/crs/trace/ocssd.trc 9.4M ./grid/diag/tnslsnr/swnode2/listener_scan1/alert/log.xml 9.4M ./grid/diag/crs/swnode2/crs/trace/osysmond.trc 8.6M ./oracle/diag/rdbms/gnnt/gnnt2/incident/incdir_2520377/gnnt2_mmon_27452_i2520377.trc 8.3M ./grid/diag/tnslsnr/swnode2/listener/alert/log.xml 8.1M ./grid/diagsnap/swnode2/diagsnap_swnode2.log 7.9M ./grid/crsdata/swnode2/qos/logs 7.5M ./grid/diag/crs/swnode2/crs/trace/ocssd_76.trm /grid/rdbms/audit/+ASM2_ora_51680_20180705152908123581143795.aud 6.9M ./oracle/admin/gnnt/adump/gnnt2_ora_19062_20180705235537335003143795.aud /grid/srvm/admin 6.6M ./grid/diag/tnslsnr/swnode2/asmnet1lsnr_asm/alert/log.xml 5.7M ./grid/diag/crs/swnode2/crs/trace/ohasd_cssdmonitor_root.trc 5.6M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_mmon_27452.trm 5.6M ./grid/diag/crs/swnode2/crs/trace/crsd.trc 5.5M ./grid/diag/crs/swnode2/crs/trace/ohasd_oraagent_grid.trm 5.1M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/incident 5.0M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/incident/incdir_48265 4.8M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_gen0_27237.trm /grid/log/swnode2/client 4.6M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/incident/incdir_48265/-MGMTDB_mmon_42907_i48265.trc 4.6M ./grid/diag/crs/swnode2/crs/trace/crsd_orarootagent_root.trc 4.5M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_dia0_27310_base_1.trm 4.4M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_dbrm_27277.trc 4.4M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/-MGMTDB_dbrm_42768.trc 4.4M ./grid/diag/asm/+asm/+ASM2/trace/+ASM2_gen0_7361.trm 4.3M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/-MGMTDB_mmon_42907.trm 4.3M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/-MGMTDB_gen0_42706.trm 4.3M ./grid/diag/asm/+asm/+ASM2/trace/+ASM2_mmon_7475.trm 4.3M ./grid/diag/apx/+apx/+APX2/trace/+APX2_gen0_7836.trm 4.2M ./grid/diag/crs/swnode2/crs/trace/ohasd_cssdagent_root.trc 3.9M ./grid/diag/crs/swnode2/crs/trace/crsd_oraagent_grid.trm 3.8M ./oracle/diag/rdbms/gnnt/gnnt2/trace/alert_gnnt2.log /db_1/cfgtoollogs/opatch 3.6M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/alert_-MGMTDB.log 3.6M ./grid/diag/crs/swnode2/crs/trace/crsd_jagent_grid.trc 3.5M ./grid/diag/asm/+asm/+ASM2/alert/log.xml 3.4M ./grid/diag/crs/swnode2/crs/trace/crsd_scriptagent_grid.trm /grid/cfgtoollogs/opatch 3.2M ./oracle/diag/rdbms/gnnt/gnnt2/alert/log.xml 3.2M ./grid/diag/crs/swnode2/crs/trace/gipcd.trm 3.1M ./oracle/admin/gnnt/adump/gnnt2_ora_15879_20180706030706129797143795.aud 3.1M ./grid/diag/crs/swnode2/crs/trace/ohasd_orarootagent_root.trm 2.9M ./oracle/admin/gnnt/adump/gnnt2_j002_24048_20180705220024598306143795.aud 2.8M ./grid/diag/crs/swnode2/crs/trace/octssd.trm 2.8M ./grid/diag/crs/swnode2/crs/trace/crsd_oraagent_oracle.trc 2.7M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_lms0_27326.trc 2.7M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_dia0_27310_lws_1.trc 2.6M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_lms1_27328.trc /grid/crf/db/swnode2/proc/procdump.log 2.4M ./grid/diag/crs/swnode2/crs/trace/gpnpd.trm 2.4M ./grid/crsdata/swnode2/evm 2.1M ./oracle/diag/rdbms/gnnt/gnnt2/metadata/DFW_PURGE_ITEM.ams 2.1M ./oracle/admin/gnnt/adump/gnnt2_ora_34857_20180705221902514272143795.aud 2.1M ./grid/diag/crs/swnode2/crs/trace/ologgerd.trm 2.1M ./grid/diag/crs/swnode2/crs/trace/ohasd.trm 2.1M ./grid/diag/crs/swnode2/crs/metadata/DFW_PURGE_ITEM.ams 2.1M ./grid/diag/asmtool/user_grid/host_4152456498_107/alert/log.xml 2.1M ./grid/crsdata/@global/cvu/baseline/cvures /grid/rdbms/audit/+ASM2_ora_45011_20180630235220082856143795.aud 1.8M ./grid/diag/crs/swnode2/crs/trace/evmd.trc /grid/rdbms/audit/+ASM2_ora_13846_20180706030604564198143795.aud /db_1/cfgtoollogs/opatch/lsinv 1.7M ./oracle/admin/gnnt/adump/gnnt2_ora_19670_20180705235607678244143795.aud /grid/cfgtoollogs/opatch/lsinv 1.5M ./grid/diag/asm/user_grid/host_4152456498_107/alert/log.xml /grid/rdbms/log /grid/cdata/swnode2.olr 1.4M ./grid/diag/crs/swnode2/crs/trace/ocssd.trm 1.3M ./grid/diag/rdbms/_mgmtdb/-MGMTDB/metadata/DFW_PURGE_ITEM.ams 1.2M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_mmon_9212.trc 1.2M ./grid/diag/crs/swnode2/crs/trace/ohasd_cssdmonitor_root.trm 1.1M ./oracle/diag/rdbms/gnnt/gnnt2/trace/gnnt2_gen0_9004.trc 1.1M ./oracle/diag/rdbms/gnnt/gnnt2/incident/incdir_2520377/gnnt2_mmon_27452_i2520377.trm 1.1M ./grid/diag/tnslsnr/swnode2/mgmtlsnr/alert/log.xml 1.1M ./grid/diag/crs/swnode2/crs/trace/crsd.trm 1.1M ./grid/diag/asm/+asm/+ASM2/trace/+ASM2_lms0_7415.trc /grid/rdbms/audit/+ASM2_ora_62301_20180705155542656414143795.aud /grid/rdbms/audit/+ASM2_ora_40722_20180705195554780511143795.aud /grid/rdbms/audit/+ASM2_ora_19404_20180705235600641745143795.aud /grid/rdbms/audit/+ASM2_ora_17214_20180705115536941463143795.aud 1.0M ./grid/diag/asm/+asm/+ASM2/trace/+ASM2_gen0_7782.trc
$ du -sh `find ./ -ctime 0` | grep [0-9]M | sort -n
3、linux统计目录大小并排序 查看目录下所有一级子目录文件夹大小
格式:du -h --max-depth=1 |grep []
$du -h --max-depth= |grep [TG] |sort #查找上G和T的目录并排序
解释:
du -sh #统计当前目录的大小,以直观方式展现
du -h --max-depth=1 |grep 'G' |sort #查看上G目录并排序
du -sh --max-depth=1 #查看当前目录下所有一级子目录文件夹大小
du -h --max-depth=1 |sort #查看当前目录下所有一级子目录文件夹大小 并排序
du -h --max-depth=1 |grep [TG] |sort -nr #倒序排
4、搜索指定日期范围的文件,例如搜索/test下2017-06-03到2017-06-06之间修改过的文件
$find /test -type f -newermt -- -a ! -newermt --
Linux下的查找技巧的更多相关文章
- Linux 下文本查找技巧你掌握了吗?
前言 之前介绍过很多linux下查找相关的命令,例如<Linux中的文件查找技巧>,<find命令高级用法>,<如何查看linux中文件打开情况-lsof命令>等等 ...
- Linux下如何查找可执行文件
Linux下的可执行文件 Linux下如何查找可执行文件,作为一个Linux小菜刚刚有了这个问题, 在windows中,可以通过后缀名判断是否是可执行文件,比如.exe,.bat等是可执行文件,但是在 ...
- Linux下快速查找文件
1 locate 查找内容.查找数据库,updatedb命令更新数据库 2 which 命令 3 find 路径 -name 查找内容.find命令会磁盘查找,比较耗时. 4 grep 查找内容一般为 ...
- linux下如何查找nginx配置文件的位置
nginx的配置放在nginx.conf文件中,一般我们可以使用以下命令查看服务器中存在的nginx.conf文件. locate nginx.conf /usr/local/etc/nginx/ng ...
- [转帖]linux 下yum使用技巧
linux 下yum使用技巧 https://www.cnblogs.com/galengao/p/5750389.html 本文来自我的github pages博客http://galengao.g ...
- linux下find查找命令用法
Linux下find命令在目录结构中搜索文件,并执行指定的操作.Linux下find命令提供了相当多的查找条件,功能很强大.由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时 ...
- Linux下相关查找文件命令(find locate which whereis type)
以下内容摘自:http://blog.csdn.net/jessica1201/article/details/8139249 标注的内容为自己的补充: 我们经常需要在系统中查找一个文件,那么在lin ...
- linux下怎么查找文件
linux下通常用whereis或者是locate来检查文件,如果实在找不到,才使用find.为什么find不能作为优先考虑的命令? 因为whereis与locate是利用数据库来查找数据,所以相当快 ...
- Linux下的查找命令which、whereis、locate、find(6/20)
Linux下查找相关命令主要有以下4个:which.whereis.locate.find. (1)which [-a] cmdname1 cmdname2 ...... 命令参数: -n ...
随机推荐
- mac date
格式化UTC为可读格式 mbp:~ gavin$ date -r 1546848158 2019年 1月 7日 星期一 16时02分38秒 CST 获取当前 UTC mbp:~ gavin$ date ...
- cocos2d JS-(JavaScript) 类型检测与判断
//检测类型 var str = "Hello World"; if (typeof str=="string") {//使用typeof来判断对象类型的一个例 ...
- 转Git配置SSH,并Push到GitHub上的相关流程
首先,你可以试着输入git,看看系统有没有安装Git $ git The program 'git' is currently not installed. You can install it by ...
- HttpContext.Current.Items的用途
HTTP是一个无状态的协议.每次的请求都是独立的,它的执行情况和结果与前面的请求和之后的请求是无直接关系的,它不会受前面的请求应答情况直接影响,也不会直接影响后面的请求应答情况.而实际上,我们的系统往 ...
- 010-判断是否回传IsPostBack属性
属性IsPostBack:判断是否回传 如果是第一次请求,则返回false 如果是回传请求,则返回true->说明:只有使用服务器端表单才可以正常使用IsPostBack->使用情境:当在 ...
- 记在Archlinux中安装python的pymssql模块过程中遇到的问题
为什么要安装这个模块?因为要连接SQLServer数据库. 看到可以使用pyodbc这个模块进行连接,但对odbc不熟悉,所以选用了看起来更简单的 pymssql. 直接执行: pip install ...
- Operation(Swift)
介绍: NSOperation需要配合NSOperationQueue来实现多线程.因为默认情况下,NSOperation单独使用时系统同步执行操作,并没有开辟新线程的能力,只有配合NSOperati ...
- Spark学习之路 (二十七)图简介
一.图 1.1 基本概念 图是由顶点集合(vertex)及顶点间的关系集合(边edge)组成的一种数据结构. 这里的图并非指代数中的图.图可以对事物以及事物之间的关系建模,图可以用来表示自然发生的连接 ...
- HttpServletRequestWrapper
1). why 需要改变从 Servlet 容器 (可能是任何的 Servlet 容器)中传入的 HttpServletRequest 对象的某个行为,该怎么办? 一. 继承 HttpServletR ...
- python range函数
这个函数很简单,就不写例子了,看看语法,拿来即用 python range() 函数可创建一个整数列表,一般用在 for 循环中. 函数语法 range(start, stop[, step]) 参数 ...