Unix Fun: cowsay command

Screen Shot 2019-06-10 at 12.16.32.png

cowsay is a comman line tool that you can install on any Linux or Unix distro to render funny text updates as if they’re told by a cute text mode cow. There are lots of options to customise the look of both the cow and the text message.

Installing cowsay in Raspbian OS

I decided to install cowsay on one of my Raspberry Pi systems at home:

greys@becky:~ $ sudo apt install cowsay
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
lxkeymap python-cairo python-gtk2 python-xklavier
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
cowsay-off
Suggested packages:
filters
The following NEW packages will be installed:
cowsay cowsay-off
0 upgraded, 2 newly installed, 0 to remove and 182 not upgraded.
Need to get 27.9 kB of archives.
After this operation, 114 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.heanet.ie/mirrors/raspbian/raspbian stretch/main armhf cowsay all 3.03+dfsg2-3 [20.1 kB]
Get:2 http://ftp.heanet.ie/mirrors/raspbian/raspbian stretch/main armhf cowsay-off all 3.03+dfsg2-3 [7,816 B]
Fetched 27.9 kB in 0s (60.1 kB/s)
Selecting previously unselected package cowsay.
(Reading database ... 211819 files and directories currently installed.)
Preparing to unpack .../cowsay_3.03+dfsg2-3_all.deb ...
Unpacking cowsay (3.03+dfsg2-3) ...
Selecting previously unselected package cowsay-off.
Preparing to unpack .../cowsay-off_3.03+dfsg2-3_all.deb ...
Unpacking cowsay-off (3.03+dfsg2-3) ...
Setting up cowsay (3.03+dfsg2-3) ...
Setting up cowsay-off (3.03+dfsg2-3) ...
Processing triggers for man-db (2.7.6.1-2) ...

Using Cowsay in Linux

Just type “cowsay” followed by a few words and you’ll get something like this:

Screen Shot 2019-06-10 at 11.12.51.png

Changing the cow appearance in cowsay

From the cowsay man page:

There are several provided modes which change the appearance of the cow depending on its particular emotional/physical state. The -b option initiates Borg mode; -d causes the cow to appear dead; -g invokes greedy mode; -p causes a state of paranoia to come over the cow; -s makes the cow appear thoroughly stoned; -t yields a tired cow; -w is somewhat the opposite of -t, and initiates wired mode; -y brings on the cow’s youthful appearance.

Here’s an example of one of these options:

Screen Shot 2019-06-10 at 11.19.50.png

It’s also possible to just specify the charecters to be used for the eyes of the cow, -e option needs to be followed by the two characters you want to seeScreen Shot 2019-06-10 at 12.14.51.png:

That’s it for today, it’s been fun!

See Also