[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
[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
[oracle@zyx ~]$ ll |grep "^"|wc -l
36
[oracle@zyx ~]$ ll |grep "^d"|wc -l
2
[oracle@zyx ~]$ ls -lR /u01/app/oracle/|grep "^d"|wc -l
3162
[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
[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
[oracle@zyx ~]$ find $ORACLE_BASE -name alert*.log
/u01/app/oracle/diag/rdbms/orcl/test/trace/alert_test.log
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
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30130773/viewspace-2097122/ ,如需转载,请注明出处,否则将追究法律责任。