Siebel Administration > Useful bash commands
1) Find files in directory larger than 50000kb: find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' 2) Delete files older than 5 days: find /apps/package_name/siebel/8.1/siebsrvr/enterprises/siebeldir/siebelserver/log* -mtime +5 -exec rm {} \; 3) List files older than 15 days find * -mtime +15 4) Show files by date, descending order: ls – lt 5) Check space in folder: df –h . 6) List number of files ls -l | wc -l 7) Gzip all files older than 3 days: find /apps/package_name/siebel/8.1/siebsrvr/enterprises/siebeldir/siebelserver/log* -mtime +3 -exec gzip {} \; 8) Empty file - echo "" > filename 9) Find all files from today named WFMAOpptyAppr : find /apps/package_name/siebel/8.1/siebsrvr/enterprises/siebeldir/siebelserver/log WFMAOpptyAppr -mtime -1 -exec ls {} \;
Find all files in a Month or from a particular date
10) find . -name 'WFMAAgreeAccSyn*' -ls | grep "Dec 15" | awk '{ print $11 }' | xargs grep -c SBL- | grep -v 0$ searches for string SBL- in filenames starting with WFMAAgreeAccSyn on December 15 11) find . -name 'EAIObjMgr*' -ls | grep "Aug" | awk '{ print $11 }' | xargs grep -c string | grep -v 0$ searches for string 'string' in filenames starting with name EAIObjMgr for August month , all years 12) find . -name 'WfProcMgr*' -ls | grep "Dec 21 0" | awk '{ print $11 }' | xargs grep SBL-BPR-00164 | wc –l command in point 13 will show all files created from Dec 21 from midnight till 10 am 13) find . -name 'WfProcMgr*' -ls | grep "Dec 21 09" | awk '{ print $11 }' | xargs grep SBL-BPR-00164 | wc –l command in point 14 will show all files created on Dec 21 from 9 am till 9.59 am 14) find . -name 'EAIObjMgr_*' -ls | grep "Jan 13 13" | awk '{ print $11 }' | xargs grep SBL-EAI-04451 command 15 shows the list of files on Jan 13 from 1 pm to end of dec 13. names start with EAIObjMgr_, search string SBL-EAI-04451 15) find . -name "EAIObjMgr_enu*" -exec grep "SBL-EAI-04451" '{}' \; -print searches for string SBL-EAI-04451 in files starting with name EAIObjMgr_enu
|