|
|
Cooperative Extension Service |
|
|
|
||
|
|
||
|
Agricultural
Experiment Station |
||
|
|
|
|
Here are some AIX Unix one-liners (or, n-liners) you might find interesting or something to build from.
Get total size of files in a directory (/home here; awk adds 5th column from "ls -l" command):
ls -l /home | awk '{total += $5}; END {print total}'
Get total size of files in a directory and it's subdirectories (/home here; recursive ls):
ls -lR /home | awk '{total += $5}; END {print total}'
Get total size above, but, excluding directory entries (grep drops "ls -l" lines beginning with d):
ls -lR /home | grep -v '^d' | awk '{total += $5}; END {print total}'
Find all files for an Oracle database SID (PROD here; "find" also excludes directory names and masks error messages; egrep passes only files with database suffixes; grep excludes temp sga file) following standard naming convention (the first two lines), and create the shell commands (sed parses pathnames into directory (\1) and file (\2) names to create commands) to zip those files (using gzip (GNU zip)) into a zip directory (PROD.gzip here) while preserving the timestamps (using touch; the third line is one long line from "sed" through "zipem.shl"; the database would have to be shut down before actually running the resulting zipem.shl script):
find / -name "*PROD*" ! -type d 2>/dummy |
egrep '(\.ora$|\.dbf$|\.ctl$|\.rdo$)' | grep -v sgadef |
sed "s/\(.*\/\)\([^\/].*\)/gzip -cv1 \1\2 >\/u05\/oradata\/PROD.gzip\/\2.gz;
touch -r \1\2 \/u05\/oradata\/PROD.gzip\/\2.gz/" >zipem.shl
Get list of Oracle products installed in the current $ORACLE_HOME:
/usr/bin/cat $ORACLE_HOME/unix.prd |\
/usr/bin/nawk -F\" '{ printf ("%-40s %-10s %-20s\n", $6, $2, $4) }' |\
/usr/bin/grep '^[^ ]'
or (gives a few less):
/usr/bin/cat $ORACLE_HOME/orainst/unix.rgs |\
/usr/bin/nawk -F\" '{ printf ("%-40s %-10s %-20s\n", $6, $2, $4) }' |\
/usr/bin/grep '^[^ ]'
This Page was Last Updated on 06/04/07
You Are Visitor Number |
|
|
© 2006 |
|
|
University of Arkansas • Division of Agriculture |
Mission
•
Disclaimer
•
EEO
•
|