About Me.

My self Adinarayana working as Implementation Application DBA with advanced technologies like RAC/PCP,OID/SSO,DMZ,Exadata and Fusion Middleware i.e Demantra,Application Server,SOA,FMW,BPEL and UPK. Created this blog to share the useful information related to DBA and Application DBA Your comments and suggestions are most welcome. Disclaimer: Please note all the views and opinions expressed in this site are my own. It's not recommend to use the fixes/suggestions provided in this site directly in production instance, please test them before implementing.

Monday, July 22, 2013

Usefull Unix/Linux commnads

1) To find a "word" or pattern in all files in a directory & subdirectories
find . -name "*" -exec grep -l {} \; -print
Example: belowsearching for word
find . -name "*" -exec grep -l dba {} \; -print

2)To find a class inside a set of Jar files
for i in 'find .-name *.jar'
do
if test 'jar -tvf $i|grep QualityObject.class'
then
ls $i
fi
done

3) To unzip all the patches in 1 directory in one go
for i in *.zip
do
unzip $i
done

4)To find the symbolic links that point to the old path in your oracle_home and appl_top.
This command is useful in cloning after restore from source to target that symbolic link are not pointing to source.
ls -al `find . -type l` | grep $OLD_PATH

5)To find all the text files that contains the old path at the UNIX level.
find . -type f -print|grep -v ":"|xargs file|grep "text"|awk '{FS=":"}{print $1}'|xargs grep -il $OLD_PATH

6) To Sort files based on Size of file in a Directory
Useful in finding out spaces issues
ls -l | sort -nrk 5 | more

7)How to check if a Port is listening for any Service
netstat -an | grep $PORTNO

8)Check File size more than 2GB
ls -ltr | awk '{if ($5 >2000000000) print $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9}'

No comments:

Post a Comment