Last updated on July 13, 2020 by Dan Nanni
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.
Let's install fortune
and cowsay
as follows.
$ sudo apt-get install fortune cowsay
$ sudo yum install fortune cowsay
Once the necessary tools are installed, go ahead and 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.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean