Be the first to know and get exclusive access to offers by signing up for our mailing list(s).

Subscribe

We ❤️ Open Source

A community education resource

The completely useless fortune command on Linux

How to generate random jokes, pick categories, and add humor to server logins.

Random terminal jokes might seem pointless, but what if they could actually make logging into servers more enjoyable? In this video from Learn Linux TV, you’ll learn how the fortune command turns mundane logins into moments of mild amusement.

Jay walks through the completely useless but surprisingly fun fortune command, which displays random jokes (called “fortunes”) in your terminal. After installing the fortune-mod package, you can run fortune to get a random joke, use -s for short fortunes or -l for longer ones, and even select specific categories like literature, science, or Star Trek (though available categories vary by distribution).

The tutorial demonstrates combining fortune with other commands for added entertainment. Piping fortune into cowsay makes a cow deliver your jokes, while adding the -f tux flag to cowsay replaces the cow with a penguin. Wrapping the entire command in watch refreshes the joke every two seconds for continuous amusement.

Jay shares his practical use case: Displaying a “joke of the day” in the message of the day file that appears when logging into Linux servers. While the fortune command offers zero productivity benefits, it proves that not every Linux tool needs to be serious to have value.

Key takeaways

  • Fortune categories differ by distro – Debian and Fedora include different fortune databases, so categories like Star Trek or science may only work on certain distributions.
  • Combine fortune with cowsay for maximum fun – Piping fortune | cowsay -f tux delivers jokes via a penguin, turning pointless commands into genuinely entertaining output.
  • Actually useful in MOTD files – The fortune command makes a legitimate addition to message of the day systems, giving you something to smile about when logging into servers.

The fortune command proves that Linux has a sense of humor. Jay’s tutorial shows that even the most pointless commands can find legitimate use cases if you’re creative enough.

More from Learn Linux TV

The opinions expressed on this website are those of each author, not of the author's employer or All Things Open/We Love Open Source.

Want to contribute your open source content?

Contribute to We ❤️ Open Source

Help educate our community by contributing a blog post, tutorial, or how-to.

Two World-class Events

If you didn't make it to All Things AI, check out the event summary, and make plans to join us October 19-20 for All Things Open.

Open Source Meetups

We host some of the most active open source meetups in the U.S. Get more info and RSVP to an upcoming event.