E-Mail:
Get our new Windows 7 eBook (PDF) for $7 with 70+ Tips. Download Now!

Terminal Wisdom

  • No Related Post

Terminal Wisdom

We talked a few weeks ago about customizing your bash prompt by modifying the P1

variable in .bashrc. Today, we’ll add a little wisdom to your command line.

First, you’ll need the fortune program on your system. To check whether it’s
installed, run the following command:

    locate fortune

Most likely, you’ll find the program in /usr/games/fortune, though this location

may vary by distribution.

Now, open the .bashrc file in your home directory with your favorite editor.
Remember that this file is, indeed, prepended with the . character to hide it
from the normal ls command.

    vi .bashrc

Add the following line to the bottom of the bashrc file:

    GREET=`/usr/games/fortune/`
    echo $GREET
    echo “”

Now, you’ll be greeted with a random quote or thought from the fortune program
every time you open a new console window. This format will add a blank link
between the quote and the bash prompt. If you’d rather have only a single
additional line of code in the .bashrc file, you can add this command as:

    /usr/games/fortune

The fortune program will execute with either command.

Increased functionality? More efficient system operations? No and no. But, every

once in awhile you just have to add a little humor to the Linux mix.

What Do You Think?

 
35 queries / 0.368 seconds.