How to Add a Random Quote to Terminal7:40 AM
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:
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:
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:
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:
Save and exit. Now every time you open up Terminal you should get something like this:
xjonquilx | Mepis, Ubuntu, Fedora, Linux, Oh My!
- Change Workgroup Name in Ubuntu 11.04 (Natty Narwhal) (putokaz.wordpress.com)
- How to Become Sudoer (Administrator) in Fedora 15 (xjonquilx.co.cc)
- Redirection, Piping & Quoting Notes (codingexplorer.wordpress.com)
- [HOWTO] Install Skype in Fedora 15 64 bit | The _khAttAm_ blog (khattam.info)