I want to add a welcome message (and change a greetings row) to Linux.
echo "Hello" PS1="\u $: "
to “.profile” file, but nothing happens after the reboot. Why?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
In order to make this work, you need to understand the order and when each config file for shell is being sourced( aka loaded).
~/.profile is sourced at the time of logging in. It will be shown in TTY console perfectly fine - I personally have a message like that in my
~/.profile for when I go into TTY specifically. If you call a shell again from that session, it won't be sourced. Same thing in GUI. You log-in , the file is sourced only once.
My guess is that you are trying to show the message in the GUI terminal. When you log in into desktop your
~/.profile is already sourced, which also means it will not be sourced again in any terminal under that session, and message won't be shown. There's your problem.
The solution would be to place that message at the end of
~/.bashrc. That file is sourced when each interactive session is open, regardless of whether you are logging-in or not.
You can do so by simply adding a few lines in the
~/.bashrc file, which would make changes for only the current user for the default shell Bash. Check this out for the full explanation on showing custom-message/ASCII-art/random-one-liner as welcome to the linux terminal.