Question: I want to show a custom welcome message inside Linux terminal whenever I open a new terminal window. How can I do that?
It is extremely easy to add a plain-text welcome message in Linux terminal. All you are have to do is to include echo command in your shell startup file.
For example, if you are using bash, you can edit ~/.bashrc script, and add echo command at the beginning of the script as follows.
$ vi ~/.bashrc # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples echo "Welcome to pcDuino worlds" . . .
At this point, whenever you open a new terminal window, the message will appear inside the terminal window.
A custom welcome message can be used to spice up your terminal window. For example, here is a simple tip that makes a random quote appear inside your Linux terminal.
We use a combination of two command-line tools: fortune and cowsay. The former tool prints out a random interesting adage, and the latter utility displays (literally) a speaking cow in terminal window.
First, install fortune and cowsay on Linux.
On pcDuino Ubuntu :
$ sudo apt-get install fortune cowsay
Then add the following line at the beginning of ~/.bashrc.
$ vi ~/.bashrc # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples
echo "Welcome to pcDuino worlds"
fortune | cowsay -pn . . .
That’s it. Now go ahead and open a new terminal window. You will see something like this in your terminal window.