How to display or change a welcome message in Linux terminal

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 "This is my welcome message"
. . .

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 Debian, Ubuntu or Linux Mint:

$ sudo apt-get install fortune cowsay

On Fedora, CentOS or RHEL:

$ sudo yum 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

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.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *