《Oracle DBA的UNIX 袖珍参考手册》笔记11

续上回,内容都比较简单~

列出最近动过(touched )的文件
'2.70'*orcl-/home/oracle>ls -alt|head
总用量 540
-rw-r--r--   1 oracle oinstall 115545  8月 24 14:39 sysstat-5.0.5-1.src.rpm
-rw-------   1 oracle oinstall  17488  8月 24 06:26 .bash_history
drwx------  21 oracle oinstall   4096  8月 24 06:26 .
drwx------   2 oracle oinstall   4096  8月 24 06:26 .gconfd
-rw-------   1 oracle oinstall    378  8月 24 06:26 .ICEauthority
drwx------   7 oracle oinstall   4096  8月 24 06:26 .gnome2
-rw-------   1 oracle oinstall  10710  8月 23 21:56 .recently-used
drwx------   5 oracle oinstall   4096  8月 23 21:48 .gconf
drwxr-xr-x   3 oracle oinstall   4096  8月 23 21:47 .nautilus
当Oracle 文件被读或者写的时候都是被动过。
-l  选项显示文件的详请,包括修改时间,-t  选项会让结果按照被动过的日期排序,
但是显示中的时间仍然是修改时间。-t  会按照被动过的时间倒排序,因此用 head 。
-a  选项显示你目录下的所有文件。

显示最近修改过的文件

'2.70'*orcl-/home/oracle>ls -alc|tail
-rw-r--r--   1 oracle oinstall    596  8月 20 23:33 text.sh~
drwx------   4 oracle oinstall   4096  8月  6 12:05 .thumbnails
-rwxr-xr-x   1 oracle oinstall    409  8月 19 14:03 tian.sh
-rwxr-xr-x   1 oracle oinstall    408  8月 19 14:03 tian.sh~
-rw-r--r--   1 oracle oinstall      0  8月 19 06:54 tian.txt~
drwxr-xr-x   2 root   root       4096  8月 21 22:05 tmp.7467.old
drwx------   2 oracle oinstall   4096  8月 20 22:51 .Trash
-rwxr-xr-x   1 oracle oinstall    302  8月 19 06:30 vm.sh
-rwxr-xr-x   1 oracle oinstall    303  8月 19 06:29 vm.sh~
drwxr-xr-x   2 oracle oinstall   4096  7月 28 15:43 .xemacs
-c 输出文件的 i 节点的修改时间,并以此排序。

删除文件

删除以*.txt结尾的文本文件

'2.70'*orcl-/home/oracle>find /home/oracle -name "*.txt"
/home/oracle/Desktop/tian.txt
/home/oracle/Desktop/cjc.txt
/home/oracle/Desktop/1.txt
/home/oracle/logfile.txt
/home/oracle/tcj.txt
/home/oracle/cjcav.txt
/home/oracle/GOOD.txt
/home/oracle/filelist.txt

'2.70'*orcl-/home/oracle>find /home/oracle -name "*.txt" -exec rm {} \;
rm:是否删除有写保护的一般空文件‘/home/oracle/GOOD.txt’? y
\; 则相当于“宪法”,没什么说头,就是这么规定的,在 -exec 后面需要一个表示该命令终结的的符号。

显示文件大小(512 字节块)

有的时候我们需要快速找到比较大的trace 或者core dump 文件。通过使用du 命令,可以显示文件的大小,单位是 512 字节。如果要以kb 来显示,那么可以用  -k
'2.70'*orcl-/home/oracle>du -s *|sort -n|tail
4       text.sh
4       text.sh~
4       tian.sh
4       tian.sh~
4       vm.sh
4       vm.sh~
8       tmp.7467.old
120     sysstat-5.0.5-19.el4.i386.rpm
120     sysstat-5.0.5-1.src.rpm
228     Desktop





评论: 0 | 引用: 0 | 查看次数: 162
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 开启