Software & Apps Linux Amend 'motd' to Display a Custom Message of the Day by Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated on February 20, 2020 Linux Switching from Windows Tweet Share Email 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+F7. To try it out press Ctrl+Alt+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 later when Ubuntu is updated and you will lose your message. Adding content to the /etc/motd.tail file will keep your changes permanently. To edit the /etc/motd.tail file open a terminal window by pressing Ctrl+Alt+T at the same time. In the terminal window type the following command: sudo na 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-header10-help-text90-updates-available91-release-upgrade95-hwe-eol98-fsck-at-reboot98-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, let's create a script that 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 install fortune-mod Now type the following command to create a script in the /etc/update-motd.d folder. sudo nano /etc/update- In the editor simply type the following: #!/bin/bash/ 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+O and to exit press Ctrl+X to exit nano. You need to make the file executable. To do this run the following command: sudo chmod +x /etc/update- To try it out press Ctrl+Alt+F1 and log in 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 customize the message of the day as you see fit but here are some good options to try. First of all, there is neofetch. The screenfetch utility shows a nice graphical representation of the operating system you are using. To install neofetch type the following: sudo apt install neofetch To add screenfetch to a script in the /etc/update-motd.d folder type the following: sudo nano /etc/update-motd.d/01-neofetch Type the following into the editor: #!/bin/bash/usr/bin/neofetch Save the file by pressing Ctrl+O and the exit by pressing Ctrl+X. Change the permissions by running the following command: sudo chmod +x /etc/update-motd.d/01-neofetch 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 the weather to work install a program called ansiweather. sudo apt install ansiweather Create a new script as follows: sudo nano /etc/update- Type the following lines into the editor: #!/bin/bash/usr/bin/ansiweather -l <placename> Replace <placename> with your location (for example "Glasgow"). To save the file press Ctrl+O and exit with Ctrl+X. Change the permissions by running the following command: sudo chmod +x /etc/update- 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. Test It Out If you want to see what your new Message of the Day(MOTD) looks like, the easiest way to test it out is via SSH. If you didn't already know, you can actually SSH into your own computer. There really isn't a practical reason to do it, but you can see your message that way. Open a terminal, if you don't already have one, and enter something similar to the command below. Replace "username" with your actual username. ssh email@example.com You'll be prompted to confirm that you want to connect and enter your password. After you do, you'll be signed in, and the message that you constructed will be displayed above your prompt. When you're done checking it out, you can enter 'exit' in the terminal to close the SSH connection.