motdalso known as "Message Of The Day" daemon. The
motdmessage can by customized to fit individual needs of each user or administrator by modifying the
/etc/motdfile or script within the
In this tutorial you will learn:
- How to append additional information to
- How to modify
- How to disable selected parts of
- How to completely disable
Software Requirements and Conventions Used
|Operating System||Ubuntu 18.04 Bionic Beaver|
|Other||privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
Other Versions of this TutorialUbuntu 20.04 (Focal Fossa)
How to append additional information to motd messageIt is possible to append additional information to the default
motdmessage by creating a custom
/etc/motdfile. For example, let's append the default message with the
Welcome Ubuntu Usermessage.
Open up terminal or TTY console and enter the following linux command:
$ sudo sh -c 'echo "Welcome Ubuntu User" > /etc/motd'
How to modify motd messageModifying the
/etc/motdfile is fast and effective way on how to quickly change the welcome message. However, for more elaborate configuration it is recommend to customize the MOTD via scripts located within the
Message of the day is modular hence split into various scripts executed in order from lowest to highest number value as part of the script's file name prefix. The following scripts are located within the
/etc/update-motd.ddirectory as part of the default
$ ls /etc/update-motd.d/ 00-header 50-landscape-sysinfo 80-esm 90-updates-available 95-hwe-eol 98-fsck-at-reboot 10-help-text 50-motd-news 80-livepatch 91-release-upgrade 97-overlayroot 98-reboot-requiredEach script is assigned with executable permissions. Feel free to modify any of the above scripts to better fit the
motdmessage output into your system environment.
As an exercise, let's customize the
motdmessage to show general system information, hard disk usage and the weather information. Let's start by disabling the default scripts.
Depending on your needs you can selectively disable one or more scripts by removing the executable permissions. For our example we will disable all scripts and create a new
- Disable all current default MOTD's daemon scripts
- Install prerequisites
- Create a new script, eg.
/etc/update-motd.d/01-customwith the following bash script:
#!/bin/sh echo "GENERAL SYSTEM INFORMATION" /usr/bin/screenfetch echo echo "SYSTEM DISK USAGE" export TERM=xterm; inxi -D echo echo "CURRENT WEATHER AT THE LOCATION" # Show weather information. Change the city name to fit your location ansiweather -l bratislava
- Make this script executable
$ sudo chmod -x /etc/update-motd.d/*
$ sudo apt install inxi screenfetch ansiweather
$ sudo chmod +x /etc/update-motd.d/01-custom
How to disable motd messageAs already shown previously the system administrator can disable one or more parts of the MOTD message output by removing the executable permissions of each relevant MOTD script. To disable all scripts entirely execute:
$ sudo chmod -x /etc/update-motd.d/*Another option is to disable the MOTD message from appearing as on per user basis by creating a hidden
.hushloginwithin a user directory. Example:
$ touch $HOME/.hushlogin