🐄 Add Colorful Cows to Your Terminal

• 1 min read

Have you ever wanted to see a random, funny and colorful message every time you launch your terminal? Well I did, and and here’s how you can do it too.

Dependencies

How To

Just add this one-liner to your .bashrc and you’re all set!

# Fancy pants one-liner
fortune | cowsay -f $(node -e "var c='$(cowsay -l)'.split('  ');console.log(c[Math.floor(Math.random()*c.length)])") | lolcat --seed 0 --spread 1.0

Here’s a slightly more comprehensible version of the same code.

# Randomly select a cow name
cow=$(node -e "var c='$(cowsay -l)'.split('  ');console.log(c[Math.floor(Math.random()*c.length)])")

# Or, if you have shuf (or gshuf) installed
#  cow=$(shuf -n 1 -e $(cowsay -l))

fortune | cowsay -f "$cow" | lolcat --spread 1.0

If you enjoyed this tutorial, please consider sponsoring my work on GitHub 🤗

Now look what you've done 🌋
Stop clicking and run for your life! 😱
Uh oh, I don't think the system can't handle it! 🔥
Stop it, you're too kind 😄
Thanks for the love! ❤️
Thanks, glad you enjoyed it! Care to share?
Hacker News Reddit

×

Recommended Posts ✍🏻

See All »
• 3 min read
✨ HTML Share Buttons
Read Post »
• 3 min read
🚅 Next Stop, Yaak
Read Post »
• 4 min read
💻 Wait for User to Stop Typing, in JavaScript
Read Post »