The fortune command is a fun and quirky program that displays random quotes, witty sayings, or pieces of wisdom in your terminal. It’s a great way to add a bit of entertainment to your Linux experience.Â
This article will guide you through the process of installing and using the fortune command.
Installing fortune
Most Linux distributions don’t come with fortune pre-installed, but it’s easy to add. Here’s how to install it on different Linux distributions:
Ubuntu or Debian-based systems
Open your Terminal and run the following commands:
sudo apt install fortune-mod
Fedora or Red Hat-based systems
Use this command in your terminal:
sudo dnf install fortune-mod
Arch Linux or Manjaro:
Install fortune using:
sudo pacman -S fortune-mod
Using the fortune Command
Once installed, using fortune is incredibly simple. Here are some ways to use it:
Basic usage:
Just type fortune in your terminal and press Enter:
This will display a random quote or saying.
Specify the length of the message:
You can use flags to control the length of the messages:
Short messages (less than 160 characters):
fortune -s
Long messages (more than 160 characters):
fortune -l
Choose a specific category:
The fortune command comes with different databases of quotes. To see available categories, use:
fortune -f
Then, to use a specific category, type:
fortune <category_name>
Display aggressive content:
By default, fortune doesn’t show potentially aggressive/offensive content. If you want to include these, use:
fortune -a
Combine with other commands:
You can use fortune creatively with other commands. For instance, to have a fortune displayed every time you open a new terminal, add this line to your ~/.bashrc file:
echo $(fortune)
To know more about different flags that can be used with fortune, there is always a man page for it to refer to:
man fortune
Overall, the fortune command is a simple yet entertaining addition to your Linux system besides talking animals. Whether you’re looking for inspiration, a laugh, or just something to break the monotony of your terminal sessions, it has got you covered. Experiment with different options and categories to find the perfect setup for your needs.
Remember, the content displayed by fortune is random, so if you encounter something you don’t like, just run it again for a new quote. Enjoy your newfound source of wisdom and humor in your Linux terminal!
Have fun.