Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to show the message "hello $username, today's date is $date" as soon as you login to Ubuntu.

share|improve this question
Do you want this to happen in text mode or to prompt a messagebox? – Misery Jun 22 '13 at 7:31
2… will help you if you're aware of shell scripts. – saji89 Jun 22 '13 at 7:39
Are you logging in via GUI or commandline? – saji89 Jun 22 '13 at 7:40
Take a look at Writing shell scripts – Mitch Jun 22 '13 at 8:09
up vote 13 down vote accepted

If you want to see the message when you open the terminal or after you are login in tty1-6, just put this line at the end of ~/.bashrc file (open it from terminal with gedit ~/.bashrc):

echo "Hello $USER, today's date is $(date +"%A, %d-%m-%y")"

If you want to see the message after you are login in GUI, do the following:

  1. Create a new file

    gedit ~/bin/
  2. If you want to get a desktop notification, put next 2 lines inside:

    notify-send "Hello" "Hello $USER, today's date is $(date +"%A, %d-%m-%y")"

    Alternatively, if you want a popup (message box) to show up, put next 2 lines inside:

    zenity --info --title "Hello" --text "Hello $USER, today's date is $(date +"%A, %d-%m-%y")"
  3. Save the file and close it.

  4. Make the file exacutable:

    chmod +x ~/bin/
  5. Search in Dash for Startup Applications, open it and click Add.
  6. Under name type "Show my name and date" or something you will recognise.
  7. Under command type: /home/$USER/bin/ (change $USER with your user name).
  8. Under comment (if you want), type a brief description.

Startup Applications Preferences

share|improve this answer
That would be ~/.bashrc not ~/bashrc. Excellent tutorial for creating a startup application. – glenn jackman Jun 22 '13 at 15:34
@glennjackman Thanks for attention, I was hurried. I will correct now. – Radu Rădeanu Jun 22 '13 at 15:40
I want to be picky: don't use the suffix .sh for a bash script, it's confusing! Otherwise good answer! +1. – gniourf_gniourf Jun 22 '13 at 15:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.