Amend "motd" To Display A Custom Message Of The Day To The Terminal

Hispanic man opening mail in home office
Hill Street Studios/Blend Images/Getty Images


By default when you boot into Ubuntu you will not see a message of the day because Ubuntu boots graphically.

If you log in using the command line however you will see the message of the day as defined by the /etc/motd file.

(Before continuing remember that you can get back to this display by pressing CTRL, ALT and F7)

To try it out press CTRL, ALT and F1 at the same time. This will take you to a terminal login screen.

Enter your username and password and you will see the message of the day.

By default the message says something like "Welcome to Ubuntu 16.04". There will also be links to various websites for documentation, management and support.

Further messages tell you how many updates are required and how many of these are for security purposes.

You will also see some details about Ubuntu's copyright policy and usage policy.

How To Add A Message To Message Of The Day

You can add a message to the message of the day by adding content to the /etc/motd.tail file. By default Ubuntu looks in the /etc/motd file but if you edit this file it will be overwritten and you will lose your message.

Adding content to the /etc/motd.tail file will persist your changes permanently.

To edit the /etc/motd.tail file open a terminal window by pressing CTRL, ALT and T at the same time.

In the terminal window type the following command:

sudo nano /etc/motd.tail

How To Adjust The Other Information

Whilst the above example shows how to add a message to the end of the list it doesn't show how to amend the other messages already displayed.

For instance you might not want to display the "Welcome to Ubuntu 16.04" message.

There is a folder called /etc/update-motd.d folder which contains a list of numbered scripts as follows:

  • 00-header
  • 10-help-text
  • 90-updates-available
  • 91-release-upgrade
  • 95-hwe-eol
  • 98-fsck-at-reboot
  • 98-reboot-required

The scripts are basically run in order. All of these items are basically shell scripts and you can remove any of them or you can add your own.

As an example lets create a script which displays a fortune just after the header. 

To do this you will need to install a program called fortune by typing the following command:

sudo apt-get install fortune

Now type the following command to create a script in the /etc/update-motd.d folder.

sudo nano /etc/update-motd.d/05-fortune

In the editor simply type the following:


The first line is incredibly important and should be included in every script. It basically shows that every line that follows is a bash script.

The second line runs the fortune program located in the /usr/games folder.

To save the file press CTRL and O and to exit press CTRL and X to exit nano.

You need to make the file executable. To do this run the following command:

sudo chmod +x /etc/update-motd.d/05-fortune

To try it out press CTRL, ALT and F1 and login using your username and password. A fortune should now be displayed.

If you want to remove the other scripts in the folder simply run the following command replacing the <filename> with the name of the script you wish to remove.

sudo rm <filename>

For example to remove the "welcome to Ubuntu" header type the following:

sudo rm 00-header

A safer thing to do however is to just remove the scripts ability to execute by typing the following command:

sudo chmod -x 00-header

By doing this the script won't run but you can always put the script back again at some point in the future.

Example Packages To Add As Scripts

You can customise the message of the day as you see fit but here are some good options to try.

First of all there is screenfetch. The screenfetch utility shows a nice graphical representation of the operating system you are using.

To install screenfetch type the following:

sudo apt-get install screenfetch

To add screenfetch to a script in the /etc/update-motd.d folder type the following:

sudo nano /etc/update-motd.d/01-screenfetch

Type the following into the editor:



Save the file by pressing CTRL and O and the exit by pressing CTRL and X.

Change the permissions by running the following command:

sudo chmod +x /etc/update-motd.d/01-screenfetch

You can also add the weather to your message of the day. It is better to have multiple scripts rather than have one long script because it makes it easier to turn each element on and off.

To get weather to work install a program called ansiweather.

sudo apt-get install ansiweather

Create a new script as follows:

sudo nano /etc/update-motd.d/02-weather

Type the following lines into the editor:


/usr/bin/ansiweather -l <placename>

Replace <placename> with your location (for example "Glasgow").

To save the file press CTRL and O and exit with CTRL and X.

Change the permissions by running the following command:

sudo chmod +x /etc/update-motd.d/02-weather

As you can hopefully see the process is the same every time. Install a command line program if required, create a new script and add the full path to the program, save the file and change the permissions.