Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

Every week there's a new work log/to-do list at work. There's a todo script which can be used to extract my own to-do items from that. Currently this is called in ~/.bash_aliases_local, which is sourced from ~/.bash_aliases. Rather than parsing the log every time I start another shell, I'd like to use the standard MOTD (message of the day) functionality. This would involve updating a static file with the to-do list on a weekly basis:

@weekly update-motd

The resulting static text file should be printed every time I start an interactive Bash shell. What's the standard way to do this?

share|improve this question
up vote 5 down vote accepted

If you want to have the message displayed every time you open up a new terminal (under an X session), then motd is not the right place. It is executed by the login program - this happens when you log in on a real tty (or via ssh for example).

For terminal sessions, I believe the only universal way is to run cat somefile at the end of your shell's startup file: either personal (i.e. ~/.bashrc ~/.zshrc etc.) or global (under /etc - see your shell's manpage for details). Generally, I'm afraid there isn't a "standard" way of doing this in case of terminal emulator sessions.

share|improve this answer
Seems that .bashrc is not right place too. There are ~/.bash_login and ~/.bash_logout files . They're much better for OP purpose. – rush Apr 12 '12 at 13:52
@Rush .bash_login only read if bash is a login shell (and even then most people have .bash_profile instead). It would be of no help here, as the question is about all interactive shells. .bashrc is exactly the right file for this purpose. – Gilles Apr 12 '12 at 23:31

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.