LL      IIIII NN   NN KK  KK EEEEEEE RRRRRR  RRRRRR   OOOOO  RRRRRR 
LL       III  NNN  NN KK KK  EE      RR   RR RR   RR OO   OO RR   RR
LL       III  NN N NN KKKK   EEEEE   RRRRRR  RRRRRR  OO   OO RRRRRR 
LL       III  NN  NNN KK KK  EE      RR  RR  RR  RR  OO   OO RR  RR 
LLLLLLL IIIII NN   NN KK  KK EEEEEEE RR   RR RR   RR  OOOOO  RR   RR
                                                           ramblings
____________________________________________________________________

I have always been a big fan of gnuplot as it allows you to create quick graphs on the fly, and supports piping data to it.

It’s possible to create real-time graphs using this.

I figured I’d share some useful bash oneliners:

# graphical traceroute
traceroute -q1 slashdot.org | sed '1 d' | awk '{print $1"\t"$4"\t"$2}' | \
gnuplot -persist -e 'set xtics rotate by -45' -e 'plot "-" using 2:xticlabels(3) with lines'

traceroute with gnuplot

# disk usage plot
find . -maxdepth 1 -type d -not -name . -exec du -s {} \; | \
gnuplot -persist -e 'set style histogram' -e 'set style fill solid 1.0 border 3' \
-e 'set style data histogram' -e 'set xtics rotate by -45' -e 'plot "-" using ($1/1024):xtic(2)'

disk usage gnuplot

I think gnuplot is an example of a graphical application done right – you can script it, pipe to it, etc…
I wish more graphical applications were written in a way that they can be combined with bash-kungfu

Some more examples:

# graphical 'top' with the 5 highest cpu consuming processes
 ps aux | awk '{print $3"\t"$11}' | sort -rn | head -n5 |\
 gnuplot -persist -e 'set style histogram' \
-e 'set style fill solid 1.0 border 3' \
-e 'set style data histogram' \
-e 'set xtics rotate by -45' \
-e 'plot "-" using 1:xtic(2)'

# same as above but with memory consumption
ps aux | awk '{print $4"\t"$11}' | sort -rn | head -n5 |\
gnuplot -persist -e 'set style histogram' \
-e 'set style fill solid 1.0 border 3' -e 'set style data histogram'\
-e 'set xtics rotate by -45' -e 'plot "-" using 1:xtic(2)'

 
____________________________________________________________________