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.

No comments:

© Jadu Saikia www.UNIXCL.com