23 Jan 2011

Creating ASCII ART MOTD

MOTD or "Message of The Day" in most Unix systems is displayed after successful login, but before execution of user shell. MOTD is used to send a common message to all system users (after login), in a more efficient manner than sending them all an e-mail message. MOTD message is stored in /etc/motd file.

MOTD is not only used in Unix/Linux but it become a common feature of the online services like IRC and game clients.

How to create MOTD for your Linux box?

The easiest way to create nice MOTD is to use linux_logo application, which can be installed using apt-get install linuxlogo (warning: it also changes default MOTD!).

Usage of linux_logo application

NOTE: My blogger template destroyed ASCII ART below, sorry :(

$ linux_logo  -k -a -b -L 26 -F "Host: #H (#V).\\n CPU: #T\\n RAM: #R"
              .-. 
        .-'``(|||) 
     ,`\ \    `-`.               88                         88 
    /   \ '``-.   `              88                         88 
  .-.  ,       `___:    88   88  88,888,  88   88  ,88888, 88888  88   88 
 (:::) :        ___     88   88  88   88  88   88  88   88  88    88   88 
  `-`  `       ,   :    88   88  88   88  88   88  88   88  88    88   88 
    \   / ,..-`   ,     88   88  88   88  88   88  88   88  88    88   88 
     `./ /    .-.`      '88888'  '88888'  '88888'  88   88  '8888 '88888' 
        `-..-(   ) 
              `-` 


Host: jambia (2.6.32-27-generic).
 CPU: Intel(R) Core(TM) Duo CPU      T2350  @ 1.86GHz
 RAM: 2GB

Get All Available logos in linux_logo package

Available logos (can be displayed using linux_logo -L list):
Available Built-in Logos:
 Num Type Ascii Name  Description
 1 Classic Yes aix  AIX Logo
 2 Classic Yes bsd  FreeBSD Logo
 3 Banner Yes bsd_banner FreeBSD Logo
 4 Classic Yes irix  Irix Logo
 5 Banner Yes solaris  The Default Banner Logos
 6 Banner Yes banner-simp Simplified Banner Logo
 7 Banner Yes banner  The Default Banner Logo
 8 Classic Yes classic-nodots The Classic Logo, No Periods
 9 Classic Yes classic-simp Classic No Dots Or Letters
 10 Classic Yes classic  The Default Classic Logo
 11 Classic Yes core  Core Linux Logo
 12 Banner Yes debian_banner Debian Banner (white) 
 13 Classic Yes debian_old Debian Old Penguin Logos 
 14 Classic Yes debian  Debian Swirl Logos
 15 Classic Yes gnu_linux Classic GNU/Linux
 16 Banner Yes mandrake_banner Mandrake(TM) Linux Banner
 17 Banner Yes mandrake Mandrakelinux(TM) Banner
 18 Banner Yes mandriva Mandriva(TM) Linux Banner
 19 Banner Yes pld  PLD Linux banner
 20 Banner Yes redhat  RedHat Banner (white) 
 21 Banner Yes slackware Slackware Logo
 22 Banner Yes sme  SME Server Banner Logo
 23 Banner Yes sourcemage_ban Source Mage GNU/Linux banner
 24 Banner Yes sourcemage Source Mage GNU/Linux large
 25 Banner Yes suse  SUSE Logo
 26 Banner Yes ubuntu  Ubuntu Logo

Do "linux_logo -L num" where num is from above to get the appropriate logo.

Checking out all available logos

for x in `seq 1 26` ; do 
 clear ; 
 linux_logo  -k -a -b -L $x -F "Host: #H (#V).\\n CPU: #T\\n RAM: #R" ; 
 sleep 2 ; 
done

Creating custom MOTD logo

FIGlet is a computer program that generates text banners, in a variety of typefaces, composed of letters made up of conglomerations of smaller ASCII characters. Installation of FIGlet is really simple apt-get install figlet.

Creating more personalized MOTD using FIGlet

$ figlet -f slant jambia
       _                 __    _      
      (_)___ _____ ___  / /_  (_)___ _
     / / __ `/ __ `__ \/ __ \/ / __ `/
    / / /_/ / / / / / / /_/ / / /_/ / 
 __/ /\__,_/_/ /_/ /_/_.___/_/\__,_/  
/___/                                 

My MOTD (linux_logo + FIGlet)

              .-
        .-'``(|||)
     ,`\ \    `-`.           _                 __    _
    /   \ '``-.   `         (_)___ _____ ___  / /_  (_)___ _
  .-.  ,       `___:       / / __ `/ __ `__ \/ __ \/ / __ `/
 (:::) :        ___       / / /_/ / / / / / / /_/ / / /_/ /
  `-`  `       ,   :   __/ /\__,_/_/ /_/ /_/_.___/_/\__,_/
    \   / ,..-`   ,   /___/
     `./ /    .-.`
        `-..-(   )
              `-`

Host: jambia (2.6.32-27-generic).
 CPU: Intel(R) Core(TM) Duo CPU      T2350  @ 1.86GHz
 RAM: 2GB

Additional references:

1 comment:


  1. , _ / , _ / , _ / ____ \,___, _/_ _/_ /
    | | | | | | | | | ( | \ | | |,---.
    ` ^ ' ` ^ ' ` ^ ' `--. | | | | |' `
    \/ \/ \/ \/ \/ \/ \___.' |`---' \__/ \__/ / |
    \
    \ _ ,__
    | , __. __. \ ___ ___ ___ ___ / `
    | / .' \ .' \ |/ \ .' ` .' ` / ` |__
    |-< | | | | | ` |----' | | | |
    / \_ `._.' `._.' `___,' `.___, `._.' `.__/| |
    /

    , _ , _ __. ___
    |' `|' `. .' \ .' `
    | | | | | |
    / ' / `._.' `._.'

    ____ ___ ,__ _
    | / \ .___ ___ / ` .___ , . ____ ___/ , __ ` , _ /
    `---. `---| / \ .' ` |__ / \ | | ( / | |' `. | | | |
    | | | ' |----' | | ' | | `--. ,' | | | | ` ^ '
    \__.' `---' / `.___, | / `._/| \___.' `___,' / | / \/ \/
    / `

    ReplyDelete