Oct 152009
 

Terminal should be ANSI compliant and support colour escape sequences. Modern terminal should do the job.

The following is a list of escape sequences

The ^[ is produced by pressing Ctrl-V then ESC

I’m using vi as text editor and there’s no problem with ctrl-V ESC, i’m not test it on other text editor.

^[[0m    - Reset the terminal characteristics
^[[1m    - emphasis (bold)

^[[30m    - Foreground black
^[[31m    - Foreground red
^[[32m    - Foreground green
^[[33m    - Foreground yellow
^[[34m    - Foreground blue
^[[35m    - Foreground magenta
^[[36m    - Foreground cyan
^[[37m    - Foreground white

^[[40m    - Background black
^[[41m    - Background red
^[[42m    - Background green
^[[43m    - Background yellow
^[[44m    - Background blue
^[[45m    - Background magenta
^[[46m    - Background cyan
^[[47m    - Background white

example

# vi /etc/motd

^[[32m#########################################^[[0m
^[[32m#           my.server.com               #^[[0m
^[[32m#########################################^[[0m
^[[0m

example

coloured motd

  3 Responses to “Colouring MOTD”

Comments (3)
  1. Thank you so much! Loved it!

  2. thank you, there are useful

  3. thank you , there are useful

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.