Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Which Unix command (part 2)
Here is another jewel I picked up from the shell news groups years and years ago.
6409:oracle_at_bart> cat dtree
#!/bin/ksh
# usage: vtree [-a] [dir] : make a tree printout of the specified
directory.
[ X$1 = X-a ] && andfiles=ON shift
[ $# = 0 ] && set .
set X "$@"
until shift
[ $# = 0 ] do [ ! $# = 1 ] && echo cd $1 || continue echo "${BOLD}----------------------- ${PWD} in KBytes -----------------------${PLAIN}" du -k ${andfiles:+-a} | sort +1f | awk '{ print $2 "-----" $1 }' | sed \}'
-e 's/^\([0-9]*\) \(.*\)$/\2 \ (\1)/' \
-e "s#^$1##" \
-e 's#[^/]*/\([^/]*\)$#|____\1#' \
-e 's#[^/]*/#| \ \ \ #g' | awk -F"-" '{printf ("%10s %s\n", $6, $1)
Brian P. MacLean
Oracle DBA, OCP8i
Brian P MacLean To: ORACLE-L_at_fatcity.com cc: oracledbam_at_hotmail.com 04/29/02 01:17 Subject: Re: Which Unix command(Document link: Brian P MacLean) PM
I build/keep several functions in my .profile file (see below). They are all simple enough to call at anytime. Have fun....
Function Description -------------------- ------------------------------------ findc find files findl find large files findn find files created/accessed in the last day findo find open files
function findc
{
find . -name "*${1}*" -print 2>/dev/null | more
}
function findl
{
OPT_d="." OPT_s="1" OPT_n="38,12"
d) OPT_d="${OPTARG}" ;; n) OPT_n="63,60" ;; s) OPT_s="${OPTARG}" ;; h | \?) echo "usage: findl [-h] [-d starting directory] -n [-s size_meg]" echo " -d defaults to the current directory" echo " -n default sort is by size, if -n is specified then the sort is by path and name" echo " -s list files greater than or equal to 'n' meg, defaults to 1" return;;
xargs -n 20 ls -Fla {} 2>/dev/null | \
awk '{printf ("%10.10s %3.3s %-10.10s %-10.10s %12s %3.3s %2.2s %5.5s %s %s %s %s\n", \
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) }' 2>&1 | \
sort -k .${OPT_n}
}
function findn
{
find . -name "*${1}*" -ctime -1 -type f -print | sort | while read F
do
echo "$(ls -Fla ${F}) $(fuser ${F} 2>/dev/null | cut -c1-60)"
done | \
awk '{printf ("%10.10s %3.3s %-10.10s %-10.10s %12s %3.3s %2.2s %5.5s
%s %s %s %s %s %s %s %s %s %s %s %s\n", \
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) }' 2>&1 | sort -k .38,12 }
function findo
{
find . -name "*${1}*" -ctime -1 -type f -print | sort | while read F
do
v_CNT=$(fuser ${F} 2>/dev/null | wc -w)
if [ ${v_CNT} -ne 0 ]
then
echo "$(ls -Fla ${F}) $(fuser ${F} 2>/dev/null | cut -c1-60)"
fi
done | \
awk '{printf ("%10.10s %3.3s %-10.10s %-10.10s %12s %3.3s %2.2s %5.5s
%s %s %s %s %s %s %s %s %s %s %s %s\n", \
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) }' 2>&1 | sort -k .38,12 }
Brian P. MacLean
Oracle DBA, OCP8i
"Seema Singh" <oracledbam_at_ho To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> tmail.com> cc: Sent by: Subject: WHich Unix command root_at_fatcity.c om 04/29/02 12:08 PM Please respond to ORACLE-L
Hi
Which unix command(On Solaris) is used to find latest biggest files on
whole
server?
or
Which unix command(On Solaris) is used to find latest biggest files on
particular disk partition?
Thx
-seema
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Seema Singh INET: oracledbam_at_hotmail.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Brian_P_MacLean_at_eFunds.Com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Mon Apr 29 2002 - 16:36:07 CDT
![]() |
![]() |