linux查找oracle下的文件,linux 查找文件及统计文件信息

1.按大小排序

[oracle@zyx ~]$ ll -Sh

total 2.6G

-rw-r----- 1 oracle oinstall 1.1G Apr 30

01:05 example_01.dbf

-rw-r--r-- 1 oracle oinstall 519M Apr 23

07:35 full.dmp

-rw-r----- 1 oracle oinstall 498M Apr 30

11:47 undotbs02.dbf

-rw-r--r-- 1 oracle oinstall 409M Apr 22

16:45 hr.dmp

-rw-r--r-- 1 oracle oinstall  33M Apr 23 07:54 fullimp.log

-rw-r----- 1 oracle oinstall  33M Apr 30 01:05 zyx_01.dbf

2.按时间排序

[oracle@zyx ~]$ ll -rth

total 2.6G

-rw-r----- 1 oracle oinstall  33M Apr 23 03:43 temp01.dbf

-rw-r--r-- 1 oracle oinstall 519M Apr 23

07:35 full.dmp

-rw-r--r-- 1 oracle oinstall  33M Apr 23 07:54 fullimp.log

-rw-r--r-- 1 oracle oinstall 4.0K Apr 27

00:51 hrimp.log

-rw-r----- 1 oracle oinstall 9.4M Apr 27

03:03 02r425b7_1_1.ctl

-rw-r----- 1 oracle oinstall  33M Apr 27 21:19 temp2.dbf

-rw-r----- 1 oracle oinstall  33M Apr 27 21:20 temp1.dbf

3.统计当前文件夹下文件的个数

[oracle@zyx ~]$ ll |grep "^"|wc

-l

36

4.统计当前文件夹下目录的个数

[oracle@zyx ~]$ ll |grep "^d"|wc

-l

2

5.统计文件夹下目录的个数,包括子文件夹里的

[oracle@zyx ~]$ ls -lR

/u01/app/oracle/|grep "^d"|wc -l

3162

6.统计/home/oracle目录(包含子目录)下的所有temp文件则:

[oracle@zyx ~]$ ls /home/oracle/temp*

/home/oracle/temp01.dbf  /home/oracle/temp1.dbf  /home/oracle/temp2.dbf

[oracle@zyx ~]$ ls -lR /home/oracle/ |grep

temp|wc -l

3

7.查找/home/oracle目录下(保护子目录)下scott文件,并做统计

[oracle@zyx ~]$ ls -lR /home/oracle/|grep

scott

-rw-r--r-- 1 oracle oinstall      24576 Apr 29 01:29 scott.dmp

-rw-r--r-- 1 oracle oinstall       1497 Apr 29 01:29 scott_log.log

-rw-r----- 1 oracle oinstall 266240 Apr 29

01:36 scott1.dmp

-rw-r----- 1 oracle oinstall 282624 Apr 28

19:56 scott.dmp

[oracle@zyx ~]$ ls -lR /home/oracle/|grep

scott|wc -l

4

8.查找alertORACLE_SID.log (oracle告警日志)

[oracle@zyx ~]$ find $ORACLE_BASE -name

alert*.log

/u01/app/oracle/diag/rdbms/orcl/test/trace/alert_test.log

9.grep查询

grep [选项参数]“要查找的内容字符串"路径

-r:递归查找子目录

-l:只显示文件名

./:当前目录路径

查询文件中包含"EXP"字符的文件

[oracle@zyx ~]$ grep -rl "EXP" ./

./dump/fulldp.log

./hrimp.log

./scottimp.log

./expdp/export.log

./scottimp1.log

./hrimp1.log

./fullimp.log

./.bash_history

如果想把"./"和"/"去掉,可以利用sed

[oracle@zyx ~]$ grep -rl "EXP" ./

|sed "s;./;;g"

dumpfulldp.log

hrimp.log

scottimp.log

expdpexport.log

scottimp1.log

hrimp1.log

fullimp.log

.bash_history

如果只想把"./"去掉,如下,需要用到"\"将"."转义

[oracle@zyx ~]$ grep -rl "EXP" ./

|sed "s;\./;;g"

[oracle@zyx ~]$ grep -rl "EXP" ./

|awk -F'\\./' '{print $2}'

dump/fulldp.log

hrimp.log

scottimp.log

expdp/export.log

scottimp1.log

hrimp1.log

fullimp.log

.bash_history

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值