![]() You can test it on the command-line like this: $ /usr/games/fortune | /usr/games/cowsay -n Now you’ll get a fortune wrapped in cowsay at every login. Then add this line to /etc/update-motd.d/99-footer: exec /usr/games/fortune | /usr/games/cowsay -n They’re all plain text files so you can easily edit them and add your own messages, if you feel creative. There are many different fortune databases you can install, which you can find with apt-cache search fortune. On Debian and Ubuntu, install fortune-mod and cowsay. Q: What's tiny and yellow and very, very, dangerous?Ī: A canary with the super-user password. Wouldn’t you prefer to have a talking cow deliver a different fortune when you login? _ ![]() Jazzing Up Your MOTD With Fortune and Cowsay You can read the files in /etc/update-motd to see which scripts the other lines come from, and if you want to find all the scripts that touch MOTD try running sudo grep -ir motd /etc. Which looks like this: Welcome to Linux Mint 13 Maya (GNU/Linux 3.2.0-23-generic x86_64) Here is a simple example that outputs two lines of text separated by linebreaks: printf "n wakka wakka wakka n n wakka n" So what if you want to put your own inspirational message in MOTD on Debian and Ubuntu? /etc/update-motd.d/99-footer is reserved for this, but it’s a shell script so you can’t just add a text message, but must use shell commands. etc/motd is symlinked to /var/run/motd, so anything you write in it will be overwritten. It uses a batch of scripts in /etc/update-motd that are executed by the pam_motd module when users login, and information from the various scripts is assembled in /var/run/motd. MOTD on Debian and Ubuntuĭebian and Ubuntu use a dynamic scripting framework, update-motd. There is a way around this, which I shall return to in a moment. But this doesn’t let you run fun commands, like cowsay and fortune. So all you do to change the message is edit /etc/motd, in plain text. In the olden days the message came from /etc/motd, and most distros still use this. ![]() How you do these depends on your Linux distro. This is how it looks on Linux Mint: Welcome to Linux Mint 13 Maya (GNU/Linux 3.2.0-23-generic x86_64)īut that is boring, and I want it to look like this: / BOFH excuse #365: Or open an SSH session to another Linux PC. You can see this in action by pressing Ctrl+Alt+F2 to get to a console, and then login. Message of the Day, or motd, displays a message on console logins. MOTD, or Message of the Day, has evolved from a simple text file to an entire scripted framework that can display ANSI art, static text messages, and display dynamic system information. But they’re still there, they’re still fun, and best of all they’re configured with nice easy text files. There are a lot of cool old Linux commands that we don’t see anymore because they’re buried under our flashy graphical desktops.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |