[#]: subject: "Moo! There is a Cow in My Linux Terminal" [#]: via: "https://itsfoss.com/cowsay/" [#]: author: "Sreenath https://itsfoss.com/author/sreenath/" [#]: collector: "lkxed" [#]: translator: " " [#]: reviewer: " " [#]: publisher: " " [#]: url: " " Moo! There is a Cow in My Linux Terminal ====== The Linux terminal can be a fun place if you want it to be. Of course, it is used for serious work but you have [funny Linux commands][1] to amuse yourself. The cowsay is one such tool. It gives you a cow in the terminal. ![Cowsay command in Linux][2] The thing about cowsay is that it could be used for 'serious work' if combined with other commands. One such example is using it to display the 'message of the day' on a shared Linux server with multiple users. Sounds interesting? Time to ̶m̶i̶l̶k̶ install it. ### Install Cowsay Cowsay is a popular tool and it is available in the repositories of most Linux distributions. To install cowsay in Debian and Ubuntu system, open a terminal and run: ``` sudo apt install cowsay ``` For Fedora, use: ``` sudo dnf install cowsay ``` And in Arch Linux based distros, use: ``` sudo pacman -S cowsay ``` ### Using Cowsay As the name suggests, this is an ASCII talking cow, that outputs text provided as its input. By default, cowsay provides several options to tweak the look and appearance of the ASCII cow. #### Normal Cowsay ``` cowsay ``` This will print whatever text you provided in a speechbubble with the cow . ![The default cowsay command][3] Or you can provide output of another command, say `echo` as input to cowsay using pipes redirection. ``` echo "Hello" | cowsay ``` #### Greedy Cow Here, cow appears to be greedy, with Dollar eyes. ``` cowsay -g ``` ![Cowsay command with greedy option][4] #### Use Special Characters as eyes You can use the `-e` option, and then provide two characters that you want to appear as eyes. The default is “OO”. ``` cowsay -e hh ``` ![Cowsay command with custom eye charaters][5] Here, in the above screenshots, two “h” will appear in place of eyes. > 🚧 If the characters entered by you has already been used by any of the default option, say $$, then it is lost. #### Use another character instead of the cow Cowsay provides many other ASCII images also, which you can use through the option `-f`. List them with option `-l`: ``` cowsay -l ``` ![Various default cowsay cow files listed using "ls /usr/share/cowsay/cows/" and "cowsay -l"][6] Now, to print one of the above images, use: ``` cowsay -f ``` ![Cowsay command using different images instead of the default cow][7] Similarly, in newer versions, you can use `-r` option to randomly print one of the above images. ``` cowsay -r Hello ``` #### Other options | Option | Use | | :- | :- | | -b | Invokes Borg mode | | -d | Causes the cow to appear dead | | -p | Causes a state of paranoia to come over the cow | | -s | Makes the cow appear thoroughly stoned | | -t | A tired cow | | -y | Brings on the cow’s youthful appearance | ### Using Cowthink Cowthink is an adjoint program that come with cowsay. Instead of the speach bubble, it displays the thought bubble. It will make more sense to you if you are familiar with comic book notations. ``` cowthink Hello ``` ![Default Cowthink command][8] All the options that were mentioned with cowsay will work here as well. ### Using Cowsay with Fortune With the help of pipe redirection, you can use cowsay along with another popular fun Linux command, the `fortune` command. > 💡 Install fortune and lolcat in Ubuntu using `sudo apt install fortune lolcat` For those of you, who don’t know what `fortune`, it is a small program, that prints quotes from famous persons on a terminal. You can run it as a standalone command like: ``` fortune ``` To simply print what fortune says using cowsay, run: ``` fortune | cowsay ``` ![][9] You can also add the cowsay options to make it better: ``` fortune | cowsay -f dragon ``` ### Using a colorful cow with lolcat Many of you know lolcat and its rainbow effects on texts. So why not use it along with the above programs? All you have to do is to pipe the cowsay command to lolcat. ``` cowsay Hello | lolcat ``` ![Running cowsay and lolcat][10] Now, if you want to add `fortune` and various `cowsay` options along with this, use all such options and pipe the entire thing to lolcat, like this: ``` fortune | cowsay -f tux | lolcat fortune | cowthink -f tux | lolcat ``` ![Running fortune, cowsay and lolcat together][11] ### Third-party cow files (for advanced users) Not interested in the default cowsay cow files? Do not worry, there are a huge number of different cowfiles out there, created by enthusiast developers. Two of them, I will mention here. [https://github.com/bkendzior/cowfiles][12] and [https://github.com/paulkaefer/cowsay-files][13] You can either install the cowfiles from these repositories as mentioned on their README, or just download the required cowfile (.cow) from the repository and paste them on `/usr/share/cowsay/site-cows/`. Now, you can access that cowfile using its name: ``` cowsay -f Hello ``` You can see in the screenshot I have used a downloaded cow file, called C3PO.cow. For those of you, who want to create your own images, you can visit [Charc0al’s cowsay file][14]. ![Third Party cowfiles][15] Here, you can either download the existing files, or convert some of your images (recommend no larger than 50 × 50) for the purpose. ### Other funny uses **Use cowsay prompt to enter password in sudo commands:** ``` sudo -p "$(cowsay 'If you know the password, enter it here. Or just go away:')" ``` ![Cowsay Sudo prompt][16] **Make cowsay as an entry to your bash config, so you are greeted every time you open the terminal.** - For newer cowsay versions, like those in Fedora, add `fortune | cowsay -r | lolcat` to your `~/.bashrc`. Now, each time, you open the terminal, a new cowfile with a different quote will be printed. - For older versions of cowsay, where you cannot get the random (-r) option, you can get different files manually, and use `fortune | cowsay -f | lolcat`. **Make other commands show output using cowsay** You can make commands like `lsblk` to print the output using cowsay. Just pipe those commands. ``` lsblk | cowsay ``` **Use cowsay-beefymiracle in Fedora** `beefymiracle` is a cowsay package available in Fedora. The cow is turned into beef here (my vegetarian heart cries 😢). Use the below command to install it: ``` sudo dnf install cowsay-beefymiracle ``` Now, run: ``` cowsay -f beefymiracle ``` ![cowsay beefymiracle file][17] ### Bonus: XCowsay `xcowsay` is a graphical alternative to the normal cowsay. Here, the cow is no more ASCII, but a proper image. You can install it by: ``` sudo apt install xcowsay ``` Now run: ``` xcowsay ``` This will display the graphical cow for a specific amount of time according to the length of the text, and then disappears. **You can click on it to hide it immediately, though.** ![xcowsay command][18] What is more interesting is the cow can 'dream' images instead of texts. Or even the cow image can be changed to random images. Use either: ``` xcowsay --dream=file OR xcowsay --image=file --dream=file ``` ![][19] ![][20] You can explore the man page of `xcowsay` for more options. ### More ASCII fun in the terminal Love ASCII? How about displaying your distribution's logo in ASCII format with [Neoftech][21]? Why restrict with logo? Here are more ASCII tools for Linux terminal. Don't stop the fun in the terminal. I hope you liked this tutorial on using cowsay in various formats. It's amazing that this little tool comes with so many options and there are so many ways to use it. Which cowsay example did you like the most here? Don't say beef one 💔 -------------------------------------------------------------------------------- via: https://itsfoss.com/cowsay/ 作者:[Sreenath][a] 选题:[lkxed][b] 译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://itsfoss.com/author/sreenath/ [b]: https://github.com/lkxed/ [1]: https://itsfoss.com/funny-linux-commands/ [2]: https://itsfoss.com/content/images/2023/06/cowsay-linux.png [3]: https://itsfoss.com/content/images/2023/06/normal-cowsay.svg [4]: https://itsfoss.com/content/images/2023/06/greedy-cowsay.svg [5]: https://itsfoss.com/content/images/2023/06/cowsay-special-eyes.svg [6]: https://itsfoss.com/content/images/2023/06/cowsay-files.png [7]: https://itsfoss.com/content/images/2023/06/cowsay-different-inbuilt-files.svg [8]: https://itsfoss.com/content/images/2023/06/cowthink-normal.svg [9]: https://itsfoss.com/content/images/2023/06/fortune-cowsay.svg [10]: https://itsfoss.com/content/images/2023/06/cowsay-lolcat.svg [11]: https://itsfoss.com/content/images/2023/06/-cowsay-fortune-lolcat-tux.svg [12]: https://github.com:443/bkendzior/cowfiles [13]: https://github.com:443/paulkaefer/cowsay-files [14]: https://charc0al.github.io:443/cowsay-files/converter/ [15]: https://itsfoss.com/content/images/2023/06/charcoal-cowfiles.png [16]: https://itsfoss.com/content/images/2023/06/cowsay-sudo-prompt.svg [17]: https://itsfoss.com/content/images/2023/06/cowsay-beefymiracle-fedora.png [18]: https://itsfoss.com/content/images/2023/06/xcowsay-normal.png [19]: https://itsfoss.com/content/images/2023/06/custom-image-in-xcowsay.png [20]: https://itsfoss.com/content/images/2023/06/xcowsay-random-image-both.png [21]: https://itsfoss.com/using-neofetch/