TranslateProject/sources/tech/20211117 3 interesting ways to use the Linux cowsay command.md
2021-11-19 08:53:27 +08:00

5.7 KiB

3 interesting ways to use the Linux cowsay command

Want a just-for-fun application to play with? Try cowsay. Cow on parade.

Most of the time, a terminal is a productivity powerhouse. But there's more to the terminal than commands and configurations. Among all the outstanding open source software out there, some of it has been written just for fun. I've written about fun commands before, but this article is about just one: the venerable cowsay command.

Cowsay is a configurable talking (or thinking) cow. It accepts a text string and outputs a graphic of a cow talking. Here's a cow saying it loves Linux:



< I love Linux >
\--------------
       \   ^__^
        \  (oo)\\_______
           (__)\       )\/\
               ||----w |
               ||     ||

To get that result, all I have to type is:

$ cowsay "I love Linux"

Install cowsay on Linux

You can install cowsay with your package manager. On Debian, Mint, Elementary, and similar distributions:

$ sudo apt install cowsay

On Fedora:

$ sudo apt install cowsay-beefymiracle

Cowsay command options

Cowsay is a simple and silly application. There's no actual use for it except to provide some diverting styling for your terminal. For instance, rather than just making a cow say a fun phrase, you can make a cow with wonky eyes say a fun phrase. Type:

$ cowsay -e @@ Hello

You'll get:



< Hello >
 -------
       \   ^__^
        \  (@@)\\_______
           (__)\       )\/\
               ||----w |
               ||     ||

Or you can make it stick out its tongue. Type:

$ cowsay -T U Hello

You'll see:



< Hello >
\-------
       \   ^__^
        \  (oo)\\_______
           (__)\       )\/\
            U ||----w |
               ||     ||

Better still, you can combine the fortune command with cowsay:

$ fortune | cowsay

Now you'll have an especially smart cow:



 _______________________________________
/ we:                                   \
|                                       |
| The single most important word in the |
\ world.                                /
 ---------------------------------------
       \   ^__^
        \  (oo)\\_______
           (__)\       )\/\
               ||----w |
               ||     ||

Beefy miracle

On Fedora, there's an extra option for cowsay that's also an unofficial project mascot. For years, the Fedora installer has displayed slides promoting open source contributions. Because they were styled after the interludes at drive-in movie theaters, a common cartoon character in the slides is an anthropomorphic hot dog.

In keeping with that theme, you can invoke a so-called beefy miracle with the Fedora version of cowsay:

$ cowsay -f beefymiracle Hello Fedora

You'll end up with a perfectly silly result:



< Hello Fedora >
 --------------      .---. __
          ,    \    /     \   \    ||||
         \\\\\\\      |O___O |    | \\\||||
         \   //    | \\_/  |    |  \   /
          '--/----/|     /     |   |-'
                 // //  /     -----'
                //  \\\ /      /
               //  // /      /
              //  \\\ /      /
             //  // /      /
            /|   ' /      /
            //\\___/      /
           //   ||\     /
           \\\\_  || '---'
           /' /  \\\\_.-
          /  /    --| |
          '-'      |  |
                    '-'

Graphical cowsay

If you find yourself needing to have messages delivered to you from a graphical cow, there's the xcowsay command. It's a graphical program similar to cowsay, and it accepts a text string that's entered by the user or piped from another application like Fortune.

A cartoon cow has a speech bubble that reads "I love Linux"

Don Watkins, CC BY-SA 4.0

Fun Linux commands

While cowsay is not a useful command, it is a fun command—the equivalent of desktop widgets for your terminal. It's great for a momentary distraction and fun experiments with piping commands (try piping ifconfig to cowsay, or lsblk, or mount, or anything!). If you want to make your terminal more fun, try cowsay.


via: https://opensource.com/article/21/11/linux-cowsay-command

作者:Don Watkins 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出