Want to add a personal image or company logo for using with cowsay? It's easier than you might think to become a cowsay Picasso. Credit: Thinkstock One of the sillier, but still fun, tools available on Linux is called “cowsay”. It’s used to display a phrase along with an ASCII art image of a cow. The cowsay command allows you to create messages that are less likely to be overlooked and might come across as just a little friendlier than the other thousand or so messages most of us get every day. For example: $ cowsay This is cowsay! _________________ ----------------- ^__^ (oo)_______ (__) )/ ||----w | || || Once cowsay is installed on your system, you can create cute little messages – and you’re not limited to displaying a cow! In fact, if you wander over to the cowsay‘s directory – /usr/share/cowsay/cows – you’ll see that there’s a fairly large collection of files available. Each includes a different image. You can choose from images as diverse as a snowman and a stegosaurus. If you want to greet your Australian friends using cowsay, you might try using the koala. Note that you need to specify the cowsay file that you want to use if you want something other than the standard cow (in this case, koala.cow). You don’t have to include the .cow file extension in your command. $ cowsay -f koala Hey, how are you? ___________________ ------------------- ___ {~._.~} ( Y ) ()~*~() (_)-(_) If you want to be intimidating, on the other hand, you might try a dragon! $ cowsay -f dragon I dare you to come a little closer ____________________________________ ------------------------------------ / // |___/| / // /0 0 __ / // | / / /_/ // | @_^_@'/ /_ // | //_^_/ /_ // | ( //) | /// | ( / /) _|_ / ) // | _ ( // /) '/,_ _ _/ ( ; -. | _ _.-~ .-~~~^-. (( / / )) ,-{ _ `-.|.-~-. .~ `. (( // / )) '/ / ~-. _ .-~ .-~^-. (( /// )) `. { } / (( / )) .----~-. -' .~ `. ^-. ///.----..> _ -~ `. ^-` ^-_ ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ Personalizing cowsay You can also create your own cowsay images, and it’s not that hard to do. In the remainder of this post, I’m going to show you how. You will need to have root access to add your new file(s) to the /usr/share/cowsay/cows directory. Step 1: The art There are a couple ways to create your ascii art. You can, as I’ve done in this post, create it simply by typing keyboard characters into a file. Alternately, you can use a tool such as jp2a that turns jpg files into ASCII art, but the resultant file is like to be a bit overwhelming. Cowsay art shouldn’t be so complicated that your recipients fail to notice the message! So, I started with two images that I created – a Christmas tree and then a menorah – in honor of the December holidays. My Christmas tree looked like this: * / / / o / * / o / * / o /_ * _ / * / o /__ * __ / o * / * o / o /__ o * __ / * o / * o * / o * o /_____________________ | | _________| |_________ I called the image xmas_tree.cow. The extension is required so that cowsay can find and use it. Step 2: The cowsay setup To get my image ready for cowsay, I also needed some additional lines. Referencing one of the existing cowsay files, I found it easy to grab the ones I needed. The comments are not required, but the two lines following them are needed. # a snowman # 2020 Sandra_H-S $the_cow = As the very last line in the file, I also added EOF. This marks the end of the image and matches the EOF shown in the 3rd line shown above. These delimiting lines are required for cowsay. I quickly came to understand that the backslashes in my art needed to be "escaped" (i.e., turned into two backslashes each), so I modified my cowsay file, also adding the backslashes shown in the upper left that act as the line connecting the message to the character or image intended to be seen as delivering it. The complete file then looked like this: # a Christmas tree # 2020 Sandra_H-S $the_cow = Now typing "cowsay -f xmas_tree Merry Christmas!" shows my message as I intended. $ cowsay -f xmas_tree Merry Christmas! __________________ ------------------ * / / / o / * / o / * / o /_ * _ / * / o /__ * __ / o * / * o / o /__ o * __ / * o / * o * / o * o /_____________________ | | _________| |_________ Drawing a menorah with my keyboard was a little more trouble, but I came up with this: $ cowsay -f menorah.cow Happy Hannukah! _________________ ----------------- () || () () () () || () () () () || || || || || || || || || || || || || || || || || || || || || || || || || || || || || || || || || || || || + ++ ++ ++ ++ ++ ++ ++ +/ || || || || || || || // || || || || || || ||// || || || || || || ||/ || || || || || // _||__||__||__||__||_// ____________________/ || || || / /____ To prepare my image, I once again had to double up on the backslashes, but vi commands such as :s///g22 helped with that. Notice I had to double up my backslashes again to tell vi to turn every backslash into two backslashes. Even vi needs escapes for some characters. The cowsay file then looked like this: # a menorah # 2020 bugfarm $the_cow = Notice that my menorah has all of the candles already lit. You could, however, make a group of cowsay files if you want to light them one at a time. Related content how-to How to find files on Linux There are many options you can use to find files on Linux, including searching by file name (or partial name), age, owner, group, size, type and inode number. By Sandra Henry Stocker Jun 24, 2024 8 mins Linux opinion Linux in your car: Red Hat’s milestone collaboration with exida With contributions from Red Hat and critical collaborators, the safety and security of automotive vehicles has reached a new level of reliability. By Sandra Henry Stocker Jun 17, 2024 5 mins Linux how-to How to print from the Linux command line: double-sided, landscape and more There's a lot more to printing from the Linux command line than the lp command. Check out some of the many available options. By Sandra Henry Stocker Jun 11, 2024 6 mins Linux how-to Converting between uppercase and lowercase on the Linux command line Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. By Sandra Henry Stocker Jun 07, 2024 5 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe