To find the files which are more than 10MB.
===============================================================
ex:
cd $APPLCSF/$APPLLOG
[applmgr@node101]$ find . -name "*.out" -mtime +0 -size +10000000c -exec ls -ltrh {} \;
-rw-r--r-- 1 applmgr dba 14M Dec 6 18:22 ./o183762784.out
================================================================
To check whether the file is in use or not
================================================================
ex:
[apps@node101]$ find . -name "*.out" -mtime +0 -size +10000000c -exec fuser {} \;
./o183762784.out:
./o183762253.out:
Note if it shows any procces id means file is in use
===============================================================
To compress files
===============================================================
ex:
[apps@node101 ]$ find . -name "*.out" -mtime +0 -size +10000000c -exec compress {} \;&
[2] 3059
[appes tsgsp4000 ]$
==============================================================
To find bigger files
==============================================================
find . -name "*" -size +500000 -exec ls -tlrh {} \;
===============================================================
If you wanted to delete files by giving retention period
===============================================================
Be careful before executing below commands crosscheck once or twi
Note:Go to the location where your files exists
ex:
$APPLSCF/APPLOG
[apps@node101 ]$find . -name "*.req" -mtime +2 -exec rm {} \; &
in this example past two days all files with extension of .req will be removed
Like you can use below commands as per requirment
[oracle@node101 ]$find . -name "*.trc" -mtime +5 -exec rm {} \; &
[oracle@node101 ]$find . -name "*.trm" -mtime +10 -exec rm {} \; &
[apps@node101 ]$find . -name "*.Z" -mtime +10 -exec rm {} \; &
[apps@node101 ]$find . -name "*.t" -mtime +5 -exec rm {} \; &
No comments:
Post a Comment