平常我們使用 find , -size +100M/K/G ,就可以找到相應大小的文件了。
可是 AIX 平台下,卻好像不能使用,雖然執行起來不報錯,但是查找出來的文件卻並不是我們想要的。所以 man 了下手冊
找出n 個字節大小的文件
bc 1024*1024 1048576=1Mb
find . -size +1000000c
find . -size +1048576c
find . -size 10485760c
例如: 查找一個 800M 的大文件
find ./batch/spool -size +838860800c --800*10485760=838860800 在/batch/spool 下
注意: 一定要看清不是文件夾,只是文件
查詢所有的普通文件,並搜索"device"這個詞:
find / -type f -print | xargs grep "device"
查找當前目錄下所有的普通文件,並搜索DBO這個詞:
find . -name *\-type f -print | xargs grep "DBO"
注意\表示轉義
查詢/apps/audit目錄下,所有用戶具有讀寫和執行權限的文件,並回收其他用戶組的寫權限:
find /apps/audit -perm -7 -print | xargs chmod o-w
./myfile: commands text
./first2: commands text
./test.sql: commands text
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------