Monday, August 17, 2015

Linux commands


REMOVE ALL FILES OLDER THAN 15 DAYS:

[oracle@Linux01 dpump]$
find /u01/app/oracle/dpump/*.dmp -mtime +15 -exec rm {} \;



GZIP ALL FILES OLDER THAN 15 DAYS:

[oracle@linux01 dpump]$
find /u01/app/oracle/dpump/*.dmp -mtime +15 -exec gzip {} \;


FIND ALL EXTENSION TYPES IN CURRENT DIRECTORY -  Linux/Unix:

find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n

[atoorpu@Linux01 trace]$ find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n

SAMPLE OUTPUT :

[atoorpu@Linux01 trace]$ find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
   
    1 .log
    1 .txt
    952 .trc

    952 .trm


Note : 

Will update more.

No comments :

Post a Comment