I would like to have Ubuntu's MOTD in the fish shell.

Ubuntu's default is as follows:

Default Ubuntu MOTD

That is essentially what I would like to see when open up my terminal (terminator, which loads fishfish) As far as I can make out (Based on the information here), the default shell executes pam_motd, which in turn executes a bunch of scripts from /etc/update-motd.d

I don't know how to do this in the fish shell with any confidence. I haven't been able to find any information by searching.


  • 1
    You don't normally get the motd when you start a terminal emulator. You only see it when you log in in text mode. This answer might help. What are you trying to do? If you want to see the motd, run cat /etc/motd. On Ubuntu, that file is generated dynamically, but that has nothing to do with your shell. – Gilles 'SO- stop being evil' Sep 1 '12 at 2:11

Put this in your ~/.config/fish/config.fish:

function fish_greeting
  status --is-login
  if [ $status != 0 ] 
    cat /run/motd.dynamic

This will make sure that you don't get the double motd when logging in remotely.


all the executions you mention happen at boot, they produce the file /etc/motd simply cat /etc/motd in your config file, ie. add

cat /etc/motd

to the file ~/.config/fish/config.fish


  • Thanks! Unfortunately that only produces the welcome note and documentation link. It doesn't execute those scripts that are executed by the bash shell – eggonlegs Aug 30 '12 at 1:24
  • 1
    indeed, those are not executed by the bash shell, but by the boot procedure. In some cases they will also be the package manager or similar to let you know that there are updates, etc. to run them manually run: run-parts --lsbsysinit /etc/update-motd.d > /run/motd – Born2Smile Aug 30 '12 at 2:02
  • When I ssh in remotely, I get that update text and so forth (in bash). I guess I am confused about login shells and whatnot. – eggonlegs Sep 1 '12 at 10:26
  • 1
    The story goes: When the machine boots, all the scripts in /etc/update-motd.d are run to produce /etc/motd, thenafter whenever you start a login shell, through say ssh, the login shell (in this case bash) will display the contents of /etc/motd. So bash does not execute any scripts itself, it just displays the contents of /etc/motd when you log in. You can have any shell do that, if the shell won't do it by default, just add cat /etc/motd to the *rc-file of that shell. See my answer above for how to do that in fish shell. If what you really want is to change shell to fish, simply chsh – Born2Smile Sep 2 '12 at 11:07

From the fish shell documentation:

If a function named fish_greeting exists after initialization, it will be run when entering interactive mode. Otherwise,if an environment variable named fish_greeting exists, it will be printed.

When you set fish_greeting, this overrides the default help text.

In a properly set-up Ubuntu system, the message of the day is created with a series of scripts in /etc/update-motd.d and cached in /run/motd. So you can add to ~/.config/fish/config.fish:

function fish_greeting
    cat /run/motd

Debian-based such as Ubuntu has /etc/issue , This can a set of escape code such as \n \l , When you try to login from another tty you'll see /etc/issue's content.Of course it's when possible you don't use MOTD system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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