Tribute to the Unix Fortune Program

Introducing I Heart Quotes.

Unix used to have a lot of personality. RedHat would let you go through the entire installation in the language of ‘Redneck.’
And every server had a program called ‘fortune’ that would greet you with some manner of quote, joke, epigram, or other pithy comment. Things like this gave personality to an otherwise pretty nerdy hobby.

At some point the source of those quotes, the fortune program, stopped showing up on servers. A combination of Linux trying to compete in the corporate world and my leaving college to also compete in the corporate world led to working on servers with less personality. The fortune program still exists, but just isn’t as prevalent. I think that’s sad.

So what’s a man to do? Build a web service on top of every fortune file I could find on the internet (if you know of any that I missed, please email me). Now I (you) can get your fortune regardless of what’s installed on the server.

(I also built a digg-style website and ratings for the data, but that’s really beside the point.)

Here’s what I put in my .bash_profile to get a fortune every time I login:

alias getfortune='wget --timeout=3 -O - -q'
alias fortune='getfortune http://www.iheartquotes.com/api/v1/random'
alias myfortune='getfortune http://www.iheartquotes.com/api/v1/random?source=joel_on_software+paul_graham+prog_style
myfortune

If you’re on a Mac you probably have curl installed instead of wget. If so use this line:

alias getfortune='curl -m 3'

There’s more options on the official API page, the most important is that you can choose which sources the API pulls from (make sure you include Comic Book Guy from the Simpsons: simpsons_cbg). The available sources are below.

From geek:

esr
humorix_misc
humorix_stories
joel_on_software
macintosh
math
mav_flame
osp_rules
paul_graham
prog_style
subversion

From general:

codehappy
fortune
liberty
literature
misc
murphy
oneliners
riddles
rkba
shlomif
shlomif_fav
stephen_wright

From pop:

calvin
forrestgump
friends
futurama
holygrail
powerpuff
simon_garfunkel
simpsons_cbg
simpsons_chalkboard
simpsons_homer
simpsons_ralph
south_park
starwars
xfiles

From religious:

bible
contentions
osho

From scifi:

cryptonomicon
discworld
dune
hitchhiker

Tags: , , , ,

Leave a Reply