Thursday, September 8, 2016

Display ASCII pictures on Unix terminal


'cowsay' is a program which generates ASCII pictures of a cow with a message.
🐞  jsaikia@unixcl.com:~$ echo "Hello World" | cowsay
 _____________ 
< Hello World >
 ------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

You can change the "Cow" using the following option:
                
🐞  jsaikia@unixcl.com:~$ echo "Hello World" | cowsay -f tux
 _____________ 
< Hello World >
 ------------- 
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/

🐞  jsaikia@unixcl.com:~$ echo "Hello World" | cowsay -f elephant
 _____________ 
< Hello World >
 ------------- 
 \     /\  ___  /\
  \   // \/   \/ \\
     ((    O O    ))
      \\ /     \ //
       \/  | |  \/ 
        |  | |  |  
        |  | |  |  
        |   o   |  
        | |   | |  
        |m|   |m| 

Available text characters are:
🐞  jsaikia@unixcl.com:~$ cowsay -l
Cow files in /usr/local/Cellar/cowsay/3.04/share/cows:
beavis.zen blowfish bong bud-frogs bunny cheese cower daemon default dragon
dragon-and-cow elephant elephant-in-snake eyes flaming-sheep ghostbusters
head-in hellokitty kiss kitty koala kosh luke-koala meow milk moofasa moose
mutilated ren satanic sheep skeleton small sodomized stegosaurus stimpy
supermilker surgery telebears three-eyes turkey turtle tux udder vader

'fortune' is yet another implementation of the Unix-style fortune program that displays a random message from a database of quotations. Something like:
🐞  jsaikia@unixcl.com:~$ fortune
It is not every question that deserves an answer.
  -- Publilius Syrus
🐞  jsaikia@unixcl.com:~$ fortune
It is so soon that I am done for, I wonder what I was begun for.
  -- Epitaph, Cheltenham Churchyard

Now, you can make your cow quote the beautiful quotes from 'fortune' and create something like the one I have (I have added this to my .bash_profile):

















You can add the following to your .bash_profile or .bashrc to see a new cowsay fortune for every new terminal session:
fortune | cowsay
If you are on Mac OSX, you can get the cowsay and fortune installation details here. If you need help in getting homebrew installed on your Mac OSX, here's the help link.

Friday, January 1, 2016

Happy New Year 2016 in Unix way

Wishing everyone a great 2016 ahead !



"toilet" gives you color in UNIX terminal ! Read more here

Wednesday, November 25, 2015

Display cricket score on Unix Terminal

If your job demands you to be on Unix console all the time and you happen to be one who can not avoid watching the cricket score, something you would like:
The script:
#!/bin/sh
#Get cricket score on your unix console top corner, enjoy cricket while you work ..

columns=$(tput cols)
startpoint=$(($columns-100))
matchurl='http://www.espncricinfo.com/india-v-south-africa-2015-16/engine/match/903607.html'

while :
do
  line=$(wget -q -O- $matchurl  | awk -F '=' '/og:title/ {print $3}' | awk -F '|' '{print $1}' | sed 's/"//g')
  echo -en "\033[s"    #save current screen position & attributes
  tput cup 0 $startpoint
  echo -en "\033[42m$line\033[0m"
  echo -e -n "\033[u"
  sleep 15
done
Output:

© Jadu Saikia www.UNIXCL.com