Wednesday, February 06, 2008

Why the command line rocks...

because when you own it, you own the world.  You can literally do anything you want (given you have that privilege of course)...

Check this out.  Neat eh.

Control the command line and nothing will ever control you.  You have to understand something before you can do that stuff.

Besides, ASCII art is universal... (ctl-f for "A standard confirm")


ops$tkyte%ORA10GR2> CREATE TABLE hash_example
2 ( hash_key_column date,
3 data varchar2(20)
4 )
5 PARTITION BY HASH (hash_key_column)
6 ( partition part_1 ,
7 partition part_2 ,
8 partition part_3 ,
9 partition part_4
10 )
11 /

Table created.

ops$tkyte%ORA10GR2> insert into hash_example
2 select sysdate+rownum, 'x'
3 from all_objects
4 where rownum <= 10000;

10000 rows created.

ops$tkyte%ORA10GR2> select pname, cnt,
2 substr( rpad('*',30*round( cnt/max(cnt)over(),2),'*'),1,30) hg
3 from
4 (
5 select uo.subobject_name pname, count(*) cnt
6 from user_objects uo, hash_example he
7 where uo.data_object_id = dbms_rowid.rowid_object(he.rowid)
8 group by uo.subobject_name
9 )
10 order by pname
11 /

------------------------------ ---------- ------------------------------
PART_1 2398 ***************************
PART_2 2466 ****************************
PART_3 2563 ******************************
PART_4 2573 ******************************


Anonymous Anonymous said....

Not quite sure what the hash example has to do with anything. But, go command line!

Thu Feb 07, 10:15:00 AM EST  

Blogger Thomas Kyte said....


it's all about ascii art....

a 'graphical' histogram showing the distribution of data....

saw the "tree" in unix and that reminded me of the reports I used to do on the mainframe using SAS 20 years ago - the histograms with *****

Thu Feb 07, 10:31:00 AM EST  

Blogger Alan said....

Neat. I like this for the same reason I always liked the following link. It describes how to do "graphical" histogram in Excel:

Thu Feb 07, 11:23:00 AM EST  

Anonymous Sokrates said....

Unix Tree:
extremely cool !

Thu Feb 07, 11:33:00 AM EST  

Blogger Scott Wesley said....

Once we had a set of data the business told me should form somewhat of a bell curve, so I wrote some SQL to prove it.
I couldn't display it in the conventional manner, but a sideways bell curve using asterisks, written in SQL - I was proud of myself!
Mathematical ascii art!

Thu Feb 07, 07:31:00 PM EST  

Blogger Keith said....

I ran across this a few weeks ago. Relates well to the topic at hand.

Thu Feb 07, 10:47:00 PM EST  

Blogger Eric S. Emrick said....

I really like the Unix tree. But, come on, nothing tops the ASCII histogram :).

Fri Feb 08, 11:38:00 PM EST  

Anonymous Mladen Gogala said....

Tom, here is the same line written in Perl:

find . -type d -print|perl -e 'while (<>) { chomp; if (/^\.\/(.*)/) { @cli=split /\//, $1; for ($i=1;$i<=$#cli;$i++) { print "-"; }; print pop(@cli),"\n"; }}'

I am doing my best to ignore things like awk and sed. All CLI is equal, but Perl CLI is more equal than the other types-

Fri Feb 15, 07:51:00 AM EST  

Anonymous dario the boring said....

cpu utilization

Not too usefull, and really raw but...

sar -f sa19 -h|grep user|cut -f 6,3|awk ' {print $2,"\t", strftime("%c",$1) }'|awk '{ FS = "\t" } ;{printf ("%"($1*10)+1"s","* "); print $1,$2}'

(You could order it with sort -n before the second awk and just see peakloads...)

I'll try to do the same with some dba_hist* view to draw a timeline of sessions or get/s... Sorta of done in OEM, I think...

Thu Feb 21, 10:36:00 AM EST  

Anonymous Anonymous said....

anyone for Star-Wars (new hope) in glorious ASCII art.

Thu Feb 28, 07:11:00 AM EST  

Anonymous Anonymous said....

Doesn't the "tree" command do this anyway - and better?

Not so much a "Hey, ain't Command Line stuff just great!"; rather, "Hey! Let's all add to the hit count for a reinvention of the wheel webpage!". Or am I being a pain?

Thu Mar 20, 12:23:00 PM EDT  

Anonymous Mladen Gogala said....

Sun Microsystems Inc. SunOS 5.9 Generic May 2002
ksh: tree: not found

I live in a desert. No trees aound here.

Thu Apr 03, 03:49:00 PM EDT  

Anonymous Anonymous said....

Hi Tom

I'm working with Oracle since version 7. I've worked on 8i and 9i platform.My question is how to become an expert in oracle and performance tuning ? Please let me know .

Sat Apr 12, 09:42:00 AM EDT  


<< Home