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.
The programs included with the Debian GNU/Linux systems are free software; The exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable Iaw.
How to do it?
Remove the default MOTD. It is located in /etc/motd
.
# Remove the folder
sudo rm /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:
# mostly, the user is "Pi"
sudo nano /home/pi/.bash_profile
Then just past in the code below, anywhere within that file:
Restart the sshd
service:
# Restart the sshd service via systemctl command
sudo systemctl restart sshd
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: