Science and technology

Have a cow on the Linux command line

Welcome to the fourth day of the Linux command-line toys creation calendar. If that is your first go to to the sequence, you may be asking your self, what’s a command-line toy. We’re figuring that out as we go, however usually, it could possibly be a sport, or any easy diversion that helps you may have enjoyable on the terminal.

Some of you’ll have seen varied choices from our calendar earlier than, however we hope there’s no less than one new factor for everybody. Because nearly everybody who I’ve talked about this sequence to has requested me about it already, right this moment’s choice is an compulsory one.

You didn’t assume we’d make it by way of this sequence with out mentioning cowsay, did you?

Cowsay is an udderly improbable utility that takes textual content and outputs it because the spoken textual content of an ASCII-art bovine.

You’ll possible discover cowsay packaged in your default repositories, and even perhaps already put in. For me, in Fedora, all it took to put in was:

$ sudo dnf set up -y cowsay

Then, invoke it with cowsay adopted by your message. Perhaps you’d prefer to pipe within the fortune utility we talked about yesterday.

$ fortune | cowsay
 _________________________________________
/ If at first you do succeed, attempt to conceal
your astonishment.                      /
 -----------------------------------------
          ^__^
           (oo)_______
            (__)       )/
                ||----w |
                ||     ||

That’s it! Cowsay ships with few variations, referred to as cow recordsdata, that may often be present in /usr/share/cowsay. To see the cow file choices obtainable in your system, use -l flag after cowsay. Then, use the -f flag to attempt one out.

$ cowsay -f dragon "Run for cover, I feel a sneeze coming on."
 _______________________________________
/ Run for canopy, I really feel a sneeze coming
on.                                   /
 ---------------------------------------
                         /  //
           |___/|      /   //  
            /zero  zero  __  /    //  |    
           /     /  /_/    //   |      
           @_^_@'/   /_   //    |      
           //_^_/     /_ //     |        
        ( //) |        ///      |        
      ( / /) _|_ /   )  //       |           _
    ( // /) '/,_ _ _/  ( ; -.    |    _ _.-~        .-~~~^-.
  (( / / )) ,-.-~-.           .~         `.
 (( // / ))  '/      /                 ~-. _ .-~      .-~^-.  
 (( /// ))      `.                     /        
  (( / ))     .----~-.        -'                 .~          `. ^-.
             ///.----..>                     _ -~             `.  ^-`  ^-_
               ///-._ _ _ _ _ _ _^ - - - - ~                     ~-- ,.-~
                                                                  /.-~

My actual beef with cowsay is that I don’t have sufficient time right this moment to essentially milk the cow puns for all they’re value. The steaks are simply too excessive, and I would butcher the joke.

On a extra critical observe, I had fully forgotten about cowsay till I re-encountered it when studying Ansible playbooks. If you occur to have cowsay put in, whenever you run a playbook, you’ll get your output from a sequence of cows. For instance, operating this playbook:

- hosts:
    - localhost
  duties
:
    - motion
: ping

Might provide the following:

$ ansible-playbook playbook.yml
 __________________

 ------------------
          ^__^
           (oo)_______
            (__)       )/
                ||----w |
                ||     ||

 ________________________
< TASK [Gathering Facts] >
 ------------------------
          ^__^
           (oo)_______
            (__)       )/
                ||----w |
                ||     ||

okay: [localhost]
 _____________
< TASK [ping] >
 -------------
          ^__^
           (oo)_______
            (__)       )/
                ||----w |
                ||     ||

okay: [localhost]
 ____________
< PLAY RECAP >
 ------------
          ^__^
           (oo)_______
            (__)       )/
                ||----w |
                ||     ||

localhost                  : okay=2    modified=zero    unreachable=zero    failed=zero  

Cowsay is obtainable beneath a GPLv3 license, and yow will discover the Perl source code on GitHub. I’ve additionally seen variations floating round in different languages, so have a look round for different variants; right here’s one in R, for instance. Implementing your individual model in your language of selection would possibly even be a enjoyable programming studying job.

Now that cowsay is out of the way in which, we will transfer on to greener pastures.

Do you may have a favourite command-line toy that you simply assume I must profile? The calendar for this sequence is generally crammed out however I’ve acquired a number of spots left. Let me know within the feedback beneath, and I am going to test it out. If there’s area, I am going to attempt to embody it. If not, however I get some good submissions, I am going to do a round-up of honorable mentions on the finish.

Check out yesterday’s toy, How to bring good fortune to your Linux terminal, and verify again tomorrow for one more!

Most Popular

breakingExpress.com features the latest multimedia technologies, from live video streaming to audio packages to searchable archives of news features and background information. The site is updated continuously throughout the day.

Copyright © 2017 Breaking Express, Green Media Corporation

To Top