Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Display Debian fortune quotes when starting up terminals UNIX

Before Mac OS X, I used Debian Linux where every time I opened a new terminal window, it would display a short quote or literary reference. Sometimes they were funny, occasionally they were deep, and once in a while they were just plain dumb, but it was always entertaining to have them pop up.

Since there don't seem to be any Mac OS X ports available, I wrote a program, displayFortune (48KB download) which mimics Fortune. The quote databases are ripped right out of the Fortune archive on the Debian site, and the source is included. There's also a Read Me that explains how to use the program.

[robg adds: I tested the program, and it works as described ... and there are, indeed, some funny fortunes in the database.]

  • Currently 1.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)

Display Debian fortune quotes when starting up terminals | 6 comments | Create New Account
Click here to return to the 'Display Debian fortune quotes when starting up terminals' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
No need to reinvent the wheel
Authored by: jdera on Jan 05, '04 10:16:40AM

Users of Fink can install the fortune-mod package (fink install fortune-mod) for the "real" fortune command. Users of DarwinPorts can install the fortune package (sudo port install fortune) for the same.

[ Reply to This | # ]
No need to reinvent the wheel
Authored by: ahbe on Jan 05, '04 11:34:45AM
Hehehe, fink worked like a charm. I just had to add
to my .profile file and it works like a charm. Thanx for the tip. Ok, I just have one more question off the topic. Is there anyway to get terminal to close the window when you logout? It really irritates me that I have to close a terminal window twice.

[ Reply to This | # ]
No need to reinvent the wheel
Authored by: jdera on Jan 05, '04 11:46:16AM

With a Terminal window open, select "Window Settings" from the "Terminal" menu. This will give you the Terminal Inspector. There is a drop-down box that has "Shell" as one of its options (it's the default). You can specify that "When the shell exits", "Close only if the shell exited cleanly" (my recommendation) or "Close the window".

I recommend close only if it exited cleanly, this way if there are any errors, the window will remain on-screen. Otherwise, it gets closed automatically. Click the "Use Settings as Defaults" and it will be applied to all future Terminal windows.

[ Reply to This | # ]
Poor Title: Display Debian fortune quotes when starting up terminals
Authored by: jdera on Jan 05, '04 10:34:44AM

This article is also titled poorly. It doesn't tell you _how_ to have the fortune display when starting up terminals, merely that a utility has been made that can display a fortune. I haven't bothered to download the suggested script (I have DarwinPorts' fortune package installed), so here's how to do get pretty much anything to run when you first open a new terminal window. This works with OS X 10.3, which has bash as the default shell. Users of earlier versions of OS X will want to edit a file named .login instead of .profile.

Open up Terminal, and enter the commands cd; pico -w .profile. This will launch the pico editor with a new file, named .profile, that is located in your home directory. The file .profile is executed by the shell (bash on Panther, tcsh on earlier versions) during login. Any commands you insert in this file will be processed each time you login. Enter /opt/local/bin/fortune in the pico window, then press Ctrl+X, y, enter.

Next time you open a Terminal window, the .profile file will be run and your fortune will display. Play around with the login files a bit. There might be other things you'd like to have run at login. For more information, take a look at this article over on the O'Reilly Network.

[ Reply to This | # ]
Another Fortune port
Authored by: thinkyhead on Jan 06, '04 04:00:23AM

Here's a port I did a while ago, which (if nothing else) includes a huge number of fortunes.

| slur was here

[ Reply to This | # ]

Get fortunes from
Authored by: fuerst on Jan 07, '04 06:52:32PM
Another nice thing is this little script to get fortunes from

curl -s | \
  awk '/#F1F5FB/,/\/p/' | \
  sed 's/<.*>//g' | \
  sed 's/.$//' | \
  sed '/./!d' 
Save it in ~/Applications or ~/bin or where else you collect your scripts and call it via .profile (bash) or .login (tcsh). It needs a Internet connection of course. Original post of this script is here: I modified it to clean the output from HTML that will sometimes occure.

[ Reply to This | # ]