Krishnakanth Alagiri

Raspberry Pi — Awesome custom MOTD

Originally published at thekrishna.in

Even though the Raspberry Pi comes with an HDMI port, most projects are headless (runs without a display), which suggests you’re mostly using SSH to access the system. I’m bored of seeing the most basic login banner with no information. This login banner is your MOTD (Message of the day, Linux term). My goal here was to have something that could quickly inform me about the machine’s information I was using and knowledge of the current state. It should also be as brief as it is practical, and importantly be fast to execute.

How to do it?

Remove the default MOTD. It is located in /etc/motd.

Open /home/<user>/.bash_profile if you’re using Raspberry Pi OS (aka. Raspbian). You can edit this file however to match your needs. First you need to edit your profile:

Then just past in the code below, anywhere within that file:

Restart the sshd service:

This is how it looks

Add-ons

You could additionally edit the the above script to take advantages of packages such as neofetch and figlet to make attractive and informative MOTDs.

Using Neofetch

Neofetch is a command-line system information utility written in Bash. It prints the information of your system’s software and hardware in the Terminal. By default, the system information will be displayed alongside your operating system’s logo in ASCII.

Using Figlet

FIGlet is a program that generates text banners, in a variety of typefaces, with letters made up of combinations of smaller ASCII characters. So you can use the figlet command to turn regular terminal text into a huge fancy test, like this:

I write code 🚀. I also trade stocks for fun 📈. GitHub: github.com/bearlike