In this tutorial I'll show how to add some message (or run whatever application, echo whatever text you wish) when you start Bash in a terminal application like GNOME Terminal or Konsole.
When Bash is started in interactive way it will execute the commands found in ~/.bashrc, where ~ is you home directory. This file usually contains the PS1 variable (which holds the way the prompt looks like (by default this is user@host in most distribution), aliases, instructions to execute the /etc/bash_completion and ~/.bash_aliases files if found etc.
In order to show some message when Bash starts we will add the commands we want executed at the end of this file, so edit it with your favourite text editor, e.g. nano ~/.bashrc and add something like this:
This command will echo some random quote from a database which has over 15.000 quotes. Notice that you will have to install the fortunes package, in example on a Debian system type as root:
apt-get install fortunes
You can add any command you want executed to ~/.bashrc, for example I have those:
echo -ne "Hello, $USER! Today is $(date).\n\n"
echo -ne "System Info: $(uptime)\n\n"
echo -ne "Fortune of the Day:\n"
Here's a screenshot of the output for those commands:
As you can see, first it echoes a message to the currently logged in user, it shows the date, invokes the cal application which will display a calendar, it shows the system uptime and then echoes a quote using the fortune game.