I know you want this. And here’s how. The tutorial even noobs can follow.
There is an easter-egg in the application apt. Have a look for yourself:
apt-get moo
If you want to have a silly cow greet you when you open up a terminal window, by all means put this command at the top of your bashrc. But there is a better way of doing it. Install this application:
sudo apt-get install cowsay
Now try running it with something you want to say,
cowsay Hello! I am awesome!
______________________ < Hello! I am awesome! > ---------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
Now by using the -f option, you can choose other characters to greet you. Try out some of these:
cowsay -f tux "Hello I am groovy!" cowsay -f sheep "Baaaaaaaa" cowsay -f dragon "Rarr!"
To see all of the available options, run
cowsay -l
Wouldn’t it be great if you could have these characters say something different each time? Well, why the hell not, huh?
First make sure you have these packages:
sudo apt-get install fortunes fortunes-off
Now try running
fortune
to see a quote. Fortune has options too.
fortune -s # for short quotes fortune -l # for long quotes fortune -o # for offensive quotes
You can combine those options a little, too. So for short, offensive quotes, go ahead and run
fortune -so
So how about combining these two awesome things? Go ahead and run this:
cowsay -f tux "$(fortune)"
____________________________________ / To thine own self be true. (If not \ \ that, at least make some money.) / ------------------------------------ \ \ .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
Now we’re really getting somewhere! Combine some of the techniques we already know and we can do quite a few cool things. Let’s try a few more commands!
cowsay -f dragon "Hello, the time is $(date "+%k:%M, on %A, %d of %B, %Y.")" cowsay -f tux "$(fortune -so)"
Well, now we have lots of cool things for a fancy welcoming prompt. Let’s try and incorporate the old geek-stable, Slashdot html-headers! You’ll need an internet connection for this stuff, and faith in Slashdot’s servers not exploding for some reason. First of all let’s have a look at them:
curl -Is slashdot.org
If you look closely you’ll see a random Futurama quote in there. Brilliant! We should use those for our greeting. And it turns out we can, by running the following command:
curl -Is slashdot.org | egrep '^X-(F|B|L)' | sed 's/^..//'
which strips all the information except for the quote. Have a look at the “(F|B|L)” section. This part of the command dictates whether you receive a Fry, Bender, or Leela quote. At the moment it will get any of them, so for individual characters, you must run
curl -Is slashdot.org | egrep '^X-(F)' | sed 's/^..//' # for Fry curl -Is slashdot.org | egrep '^X-(B)' | sed 's/^..//' # for Bender curl -Is slashdot.org | egrep '^X-(L)' | sed 's/^..//' # for Leela
Wouldn’t it be awesome if we could use the ascii art from the cowsay application for these quotes? We could, but it might look a little odd:
cowsay -f tux "$(curl -Is slashdot.org | egrep '^X-(F|B|L)' | sed 's/^..//')" ____________________________________ < Fry: I'll be whatever I wanna do. > ------------------------------------ \ \ .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
We’re going to need some ascii art for Fry, Bender and Leela. Luckily for you, I’m going to give you some [gotfuturama.com]. All you need to know is that cowsay uses cowfiles, which are stored in “/usr/share/cowsay/cows/”
For Fry,
gksudo gedit /usr/share/cowsay/cows/fry.cow
And paste the following into it:
the_cow = <<EOC; $thoughts $thoughts u . x!X ."X M~~> d~~XX~~~k .u.xZ `\ \ "% d~~~M!~~~?..+"~~~~~?: " h '~~~~~~~~~~~~~~~~~~~~~? ` 4~~~~~~~~~~~~~~~~~~~~~~> ' ':~~~~~~~~~~(X+"" X~~~~> xHL %~~~~~(X=" 'X"!~~% :RMMMRMRs ^"*f` ' (~~~~~MMMMMMMMMMMx f /` % !~~~~~MMMMMMMMMMMMMc F ? ' !~~~~~!MMMMMMMMMMMMMM. ' . :": " : !X""(~~?MMMMMMMMMMMMMMh 'x .~ ^-+=" ? "f4!* #MMMMMMMMMMMMMM. /" .." `MMMMMMMMMMMMMM h .. ' #MMMMMMMMMMMM f ' (MMMMMMMMMMM : .:="" > dMMMMMMMMMMMMM "+mm+=~(" RR HMMMMMMMMMMMMM" % (MMNmHHMMMMMMMMMMMMMMF uR5 dMMMMMMMMMMMMMMMMMMMF dMRMM> dMMMMMMMMMMMMMMMMMMMF RMHMMMF=x..=" RMRMMMMMMMMMMMMMMMMF MMMMMMM 'MMMMMMMMMMMMMMMMMMF dMMRMMMK 'MMMMMMMMMMMMMMMMM" RMMRMMME 3MMMMMMMMMMMMMMMM XMMMMMMM> 9MMMMMMMMMMMMMMM~ 'MMMMMMMM> 9MMMMMMMMMMMMMMF tMMMMMMMM 9MMMMMMMMMMMMMM MMMMMMMMM 9MMMMMMMMMMMMMM 'MMMMRMMMM 9MMMMMMMMMMMMM9 EOC
For Bender,
gksudo gedit /usr/share/cowsay/cows/bender.cow
And paste the following:
$the_cow = <<EOC; $thoughts $thoughts ( ) H H _H_ .-'-.-'-. / $thoughts | | | .-------'._ | / / '.' '. $thoughts | $thoughts $thoughts @ @ / / | '---------' | _______| | .'-+-+-+| | '.-+-+-+| | """""" | '-.__ __.-' """ EOC
For Leela,
gksudo /usr/share/cowsay/cows/leela.cow
And paste the following:
$the_cow = <<EOC; $thoughts $thoughts '#%n. ..++!%+:/X!!?: ..... "X!!!!!!!!!!?: .+?!!!!!!!!!?h. X!!!!!!!!!!!!!k n!!!!!!!!!!!!!!!!?: !!!!!!!!!!!!!!!!tMMMM!!!!!!!!!!!!!!!!!!?: X!!!!!!!!!!!!!!!!!5MMM``""%X!!!!!!!!!!!T4XL !!!!!!!!!X*")!!!!!!!?L %X!!!!!!!!!k ` '!!!!!!X!` !!XX!!!!!!L 'X!!!!!!!!!> 'X!!!!M` '" X!!!!!!!X !!!!!!!!!!X X!!!f^~('> X!!!!!!!!! '!!!!!!!!!X X!!X `. X!!!!!!!!f '!!!!!!!!!! !Xf O ' '!!!!!!X" '!!!!!!!!!X "`f-. :~ MX*t!X" X!!!!!!!!!> >. W! ~! '!!!!!!!!!X :` ': X!!!!!!!!!! ~ ^` ' '!!!!!!!!!X `~~~~~~~~ ! X!!!!!!!!!X `~~~ ! '!!!!!!!!!!> > ! (!!!!!!!!!X ! !!!!!!!!!!X > ' '!!!!!!!!!! .: /:`^-. X!!!!!!!!!> /` ~/ /( `: X!!!X!!!!!: / : f f' ! `XX!M!!!!!% ~ / ~ : > 4 "*!!!* ~ ~ ' ~ > : EOC
So now go ahead and try out your skills, run them to see if they work:
cowsay -f fry "$(curl -Is slashdot.org | egrep '^X-(F)' | sed 's/^..//')" cowsay -f bender "$(curl -Is slashdot.org | egrep '^X-(B)' | sed 's/^..//')" cowsay -f leela "$(curl -Is slashdot.org | egrep '^X-(L)' | sed 's/^..//')"
Now you may have noticed that the quotes don’t always come through. That’s mainly because there is only ever one quote in the headers at any one time. Searching for a Leela quote when there is only a Bender quote available will fail! Luckily, there is a way around this. What we need to do is search the headers for the quote, and then depending on whose quote it is, bring up the cowsay application accordingly. Well lucky for you I’ve already done it for you. Paste this code at the top of your bashrc:
function futurama() { wee=$(curl -Is slashdot.org | egrep '^X-(F|B|L)' | sed 's/^..//'); if [[ $wee = "Fry"* ]]; then cowsay -f fry $(echo $wee | sed 's/^Fry: //'); fi; if [[ $wee = "Ben"* ]]; then cowsay -f bender $(echo $wee | sed 's/^Bender: //'); fi; if [[ $wee = "Lee"* ]]; then cowsay -f leela $(echo $wee | sed 's/^Leela: //'); fi; }
Now the quotes match. Save your bashrc or zshrc file and close. Now every time you’re in the mood for your Futurama fix, just fire up that command.
cowsay -f tux "$(fortune)"
____________________________________ / To thine own self be true. (If not \ \ that, at least make some money.) / ------------------------------------ \ \ .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
Now we’re really getting somewhere! Combine some of the techniques we already know and we can do quite a few cool things. Let’s try a few more commands!
cowsay -f dragon "Hello, the time is $(date "+%k:%M, on %A, %d of %B, %Y.")" cowsay -f tux "$(fortune -so)"
Pretty cool. Maybe you would like one of these, hrmm?
Awesome! :)
hi it’s not working with my egrep. i think it is a syntactical error, but i dunno.
I absolutely love your blog and find a lot of your post’s to be exactly what I’m looking for.
Would you offer guest writers to write content for you?
I wouldn’t mind composing a post or elaborating on a few of the subjects you write with regards to here. Again, awesome weblog!
Thanks for your marvelous posting! I really enjoyed
reading it, you happen to be a great author.I will be sure to bookmark
your blog and may come back down the road. I want to encourage continue your great writing, have a nice holiday weekend!
Hi! I know this is kinda off topic but I’d figured I’d ask.
Would you be interested in trading links or maybe guest writing a blog article or vice-versa?
My website addresses a lot of the same subjects as yours and I believe we could greatly benefit from each other.
If you happen to be interested feel free to shoot me an email.
I look forward to hearing from you! Fantastic blog by the way!
Hurrah, that’s what I was searching for, what a stuff! present here at this website, thanks admin of this web page.
cowsay -f dragon “Rarr!”