In today’s article, which should be a short one, we’re going to learn how to show a random fortune when you open your terminal. This should be pretty quick and easy, easy enough for anyone to follow. Read on, my delightful readers!
NOTE: You gotta be using bash for this, as evidenced by the use of ~/.bashrc.
Why this article? Well, I am having some connectivity issues and I want to ensure I get you a nice article while I have the connection to do so. I don’t want to count on enough time to write a longer article.
Besides, it’s another good day for a fun article. I am 99% confident that this article will teach you nothing of value! And that’s okay. It’s just you having fun – and having fun is always a good idea. So, this article will just be a bit more of that, some more fun…
First, you should read the previous article and follow the directions. That’s gonna be necessary for the next part. After all, you can’t get a random fortune when you open your terminal unless you’ve installed some software to do that. So, read this article:
How To: Display Your Fortune In The Terminal
Did you read that? Did you install ‘fortune’? Good… Now we can get into this article!
How To: Show A Random Fortune When You Open The Terminal:
Sorry about the ugly headline. Gotta optimize for Google, I guess.
This article requires an open terminal, like oh so many other articles on this site. Just press
With your terminal now open, we’re going to edit the ~/.bashrc
file to make it show a fortune when you open the terminal. We’ll be using nano to do so, and that’s an easy enough process.
1 | nano ~/.bashrc |
NOTE: You don’t need sudo for this, as you already own this file.
With nano opening your ~/.bashrc
file for editing, you just need to scroll to the very bottom. When you get to the bottom of the file, just add the following line:
1 | fortune |
Next, you need to save the file. To save the file with nano, press
Now, you need to reload your bash profile. That looks like:
1 | source ~/.bashrc |
Now, that should reload the terminal and profile, showing you a ‘fortune’ quote. If you want to be really sure, or if doesn’t show you a fortune, just close your terminal and open it back up again. When you open your terminal again, it should definitely show you a fortune. See? Pretty easy! It’s darned near magical!
Closure:
And there you have it. You now know how to show a random fortune when you open your terminal. ‘Snot all that hard, now is it? If I’ve gotta bang out an article with intermittent connectivity, we might as well have fun with it! Thanks for reading and we’ll get some more serious content coming up – or will we?!? I should have decent connectivity soon. It can’t stay down forever, can it?
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.