How to Display a Message Every Time You Open the Terminal on Linux (Bash)

Share
In this tutorial, we'll learn how to display a message every time you open the terminal on Linux, such as "Hello, how can I help you?" by configuring the .bashrc file.

To display a message every time you open the terminal, follow the following steps:

1: set up your ~/.bashrc file for customization by making it include your own custom ~/.my-bashrc file.

2: use echo in .my-bashrc to display the message.

echo Hello, how can I help you?

Note: this doesn't work through SSH because .bashrc isn't sourced when you SSH, but you can fix that by editing your .bash_profile to source .bashrc. [https://stackoverflow.com/a/820533 (accessed 2025-07-07)].

Note: the message displayed to users when they open the terminal is sometimes called "Message of the Day" or MotD for short. It's possible to configure this for all users through /etc/motd, but it requires root. If all you want is to show a message when you open the terminal, you don't need to change system configuration files, all you need to do is edit your .bashrc.

How to Display a Random Message Every Time You Open the Terminal

The echo command is cool, but it always prints the same thing. What if we want to display a random message on the terminal every time we open it? In that case, see:

Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments