Cool Custom Welcome Messages on Linux terminal - GeeksforGeeks

31 Jan, 2019
There is a Linux hack which can be used to display a custom message on the terminal every time we open it. This can be done by manipulating the .bashrc shell script.
What is .bashrc ?
It is a shell script that Bash runs whenever it is started interactively. You can put any command in that file that you could type at the command prompt.
Steps on how to do it :
Firstly, open the terminal and open the ./bashrc file using any editor of your choice. (Here, vim is used) .vim ~/.bashrc
The file will open in vim editor as shown in the figure below:Now, add a small line(shown below) at the beginning of ~/.bashrc and save the file and exit.echo "Welcome MAZHAR"
Now, close the terminal and open a new terminal, you will see the message as shown below:YOU ARE DONE 
Firstly, open the terminal and open the ./bashrc file using any editor of your choice. (Here, vim is used) .vim ~/.bashrc
The file will open in vim editor as shown in the figure below:
vim ~/.bashrc

The file will open in vim editor as shown in the figure below:
Now, add a small line(shown below) at the beginning of ~/.bashrc and save the file and exit.echo "Welcome MAZHAR"
Now, close the terminal and open a new terminal, you will see the message as shown below:YOU ARE DONE 
echo "Welcome MAZHAR"

Now, close the terminal and open a new terminal, you will see the message as shown below:YOU ARE DONE 
There is one another interesting way to do it It can be done by the combination of two command-line tools:
fortune and cowsay
fortune: This prints out a random interesting proverb.
cowsay: This utility displays a speaking cow in terminal window.

Let’s see how to do this:
On Ubuntu or Linux mint, install the fortune cowsay as follows:sudo apt-get install fortune cowsay
Now, open the terminal and open the ./bashrc file using any editor of your choice. (Here, vim is used)vim ~/.bashrc
Now, add a small line(shown below) at the beginning of ~/.bashrc and save the file and exit.fortune | cowsay -pn
Now, close the terminal and open a new terminal, you will see the message as shown below:Amazing!!! Isn’t it. You are done.
On Ubuntu or Linux mint, install the fortune cowsay as follows:sudo apt-get install fortune cowsay

sudo apt-get install fortune cowsay

Now, open the terminal and open the ./bashrc file using any editor of your choice. (Here, vim is used)vim ~/.bashrc

vim ~/.bashrc

Now, add a small line(shown below) at the beginning of ~/.bashrc and save the file and exit.fortune | cowsay -pn

fortune | cowsay -pn

Now, close the terminal and open a new terminal, you will see the message as shown below:Amazing!!! Isn’t it. You are done.
More Examples
Now, once fortune and cowsay is installed, by adding different parameters, different cool beings can replace the cow.Lets see each of them one by one:
Showing a Tux : add -f tux with fortune | cowsay and save and exit.fortune | cowsay -f tux
Now, open a new terminal and see the tux appearing with a message as shown below:Showing a stegosaurus : add -f stegosaurus with fortune | cowsay and save and exit.fortune | cowsay -f stegosaurus
Now,open a new terminal and see the tux appearing with a message as shown below:Many Linux terminal commands can also be piped with cowsay such as ls command.For example: Type the following command in the terminal to show the contents of a directory as the fortune message.ls | cowsay -f stegosaurus
Here is the output:One can also show a custom text as the fortune message .Type this command in the Linux terminalcowsay -f tux "GeeksForGeeks Technical Scripter Event"
Here is the output:
Showing a Tux : add -f tux with fortune | cowsay and save and exit.fortune | cowsay -f tux
Now, open a new terminal and see the tux appearing with a message as shown below:
fortune | cowsay -f tux

Now, open a new terminal and see the tux appearing with a message as shown below:
Showing a stegosaurus : add -f stegosaurus with fortune | cowsay and save and exit.fortune | cowsay -f stegosaurus
Now,open a new terminal and see the tux appearing with a message as shown below:
fortune | cowsay -f stegosaurus

Now,open a new terminal and see the tux appearing with a message as shown below:
Many Linux terminal commands can also be piped with cowsay such as ls command.For example: Type the following command in the terminal to show the contents of a directory as the fortune message.ls | cowsay -f stegosaurus
Here is the output:
ls | cowsay -f stegosaurus

Here is the output:
One can also show a custom text as the fortune message .Type this command in the Linux terminalcowsay -f tux "GeeksForGeeks Technical Scripter Event"
Here is the output:
cowsay -f tux "GeeksForGeeks Technical Scripter Event"

Here is the output:
Reference: Wiki
linux-command
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
TCP Server-Client implementation in C
ZIP command in Linux with examples
tar command in Linux with examples
curl command in Linux with Examples
UDP Server-Client implementation in C
diff command in Linux with examples
Conditional Statements | Shell Script
Compiling with g++
Tail command in Linux with examples
Mutex lock for Linux Thread Synchronization