Ready to be published? LXer is read by around 350,000 individuals each month, and is an excellent place for you to publish your ideas, thoughts, reviews, complaints, etc. Do you have something to say to the Linux community?
In this article I’m going to tell you how you can add a random quote to Terminal
In this article I’m going to tell you how you can add a random quote to Terminal, like what you see below:
Install The Fortune-Mod Package
First you will need to install the fortune-mod package. If you’re in Fedora you can do this by typing the following in to terminal as root or super user:
yum install fortune-mod
Once you have that installed, you can use the default fortunes file or you can create your own file with quotes in it.
Creating Your Own Quotes File
Create a file with Gedit. Create your quotes, adding a % variable between each new quote. Like this:
Quote 1
%
Quote 2
%
Quote 3
Save the file without a file extension. For the sake of this tutorial we will name the file quotes.
Adding Your Quotes File to Fortune-Mod
Now we need to create a .dat file for the quotes file. Open terminal in the location where you saved the quotes file and issue the following command:
strfile quotes
This will generate a quotes.dat file in the directory where you saved the quotes file. Now copy these files to the fortune-mod directory as root or super user by issuing the following commands:
cp quotes.dat /usr/share/games/fortunes
cp quotes /usr/share/games/fortunes
Test it in terminal by issuing the following command:
fortune quotes
You should have a random quote pop up.
Setting Up Random Fortunes in Terminal
This is perhaps the easiest part. Just open your ~/.bashrc file and add the following to the end of the file:
fortune quotes
Save and exit. Now every time you open up Terminal you should get something like this:
A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.
Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help