Relative Engineering

A collection of ramblings, thoughts & code snippets

I’ll call him “Moose”

linux shell ascii art

I’m an advocate and embrace modern DevOps practices and very much of the opinion that making all servers “cattle” not “pets” is the only way to provision. However, occasionally we do need a pet, lets call him “Moose”.

Now, when logging onto Moose via ssh, do you get that boring message from your defacto linux distro. Well lets look at how we can customise that, there are probably some useful reasons to do this, but I’m doing it, because well its fun …



All you English football fans may be confused to hear, this does not stand for Match Of The Day. But for Message Of The Day. This is standard application built into many linux distributions. On Debian based releases you can find the files in this directory.


Under this directory you will most likely find a several numbered files.

root@ubuntu:/etc/update-motd.d/# ls
0-header 01-sysinfo 10-help 90-updates-available

This file are executed in file name order, hence the number prefix. When a user logs into the OS the scripts are executed. These are just bash files and can be executed manualy to see the output.

sh /etc/update-motd.d/00-header

Custom Header

So lets create a custom message with some ascii art and system info. Lets add some content and pay special attention to echo command for the ascii art, as this allow us print some special chars. Edit the header file vi /etc/update-motd.d/00-header

cat << "EOF"
.--,    .--,    _____
(( \.---./ ))   /   \ ____ ____ ______ ____
'.__/o o\__.'  / \ / \ / _ \ / _ \/ ___// __ \
   {= ^ =}    /   Y   ( <_> | <_> )___ \\ ___/
    > - <    \____|__ /\____/\____/____ >\___ >
printf " Welcome to the jungle - %s (%s)\n" "$(lsb_release -s -d)" "$(lsb_release -c -s)"

Lets test the script


System info

Its useful to see the load of the machine when you login, so lets create a nice overview. As with most things in the linux world something for this already exists. Hurahhh. landscape-sysinfo is a package that well you guessed it prints a system status.

Lets create another file and the following content. vi /etc/update-motd.d/01-sysinfo

echo 'System Information:'
landscape-sysinfo --exclude-sysinfo-plugins=LandscapeLink

before the new script will run you need to make it executable. chmod +x /etc/update-motd.d/01-sysinfo Lets take a look at all this together, logout of the machine and log back in. Hopefully it looks like this …

.--,    .--,    _____
(( \.---./ ))   /   \ ____ ____ ______ ____
'.__/o o\__.'  / \ / \ / _ \ / _ \/ ___// __ \
   {= ^ =}    /   Y   ( <_> | <_> )___ \\ ___/
    > - <    \____|__ /\____/\____/____ >\___ >
Welcome to the jungle - Ubuntu 17.04 (zesty)
System Information:
System load: 0.0 Processes: 124
Usage of /: 3.8% of 109.53GB Users logged in: 1
Memory usage: 10% IP address for ens2:
Swap usage: 0% IP address for docker0:

Don’t be a Square

If you want to have something funky like moose the mouse holding up a sign with a custom message, try this…

Install the boxes package

apt-get install boxes

Create a file called 05-mouse-info

vi 05-mouse-info

With contents

boxes -a c -d mouse <<< "$(lsb_release -s -d) ($(lsb_release -c -s))"

Make the file executable and then test it out.

chmod +x 05-mouse-info
        .--, .--,
     ( ( \.---./ ) )
      '.__/o o\__.'
         {= ^ =}
          > - <
/                       \
\ Ubuntu 17.04 (zesty)  /
/                       \
\______________________ /
       ___)( )(___
      (((__) (__)))

Boxes has a ton of cool ascii art check them out boxes -l So why not create a move welcoming message for your favourite pet. #hellomoose

Other Distributions

Remember the above code is just a bash script at the end of the day. So if your OS does not have MOTD built in, you could simply add the above to a bash script and run it from ~/.bash_profile , similar scripts are executed for all shells be that ZSH, tcsh or sh


Thanks again,