Previous Next Contents

6. How to change the text-mode default from white-on-black

You will need to tell the terminal driver code that you want another default. There exists no standard way of doing this, but in case of Linux you have the setterm program.

"setterm" uses the information in the terminal database to set the attributes. Selections are done like

setterm -foreground black -background white -store

where the "-store" besides the actual change makes it the default for the current console as well. This requires that the current terminal (TERM environment variable) is described "well enough" in the termcap database. If setterm for some reason does not work, here are some alternatives:

6.1 Xterm

One of these xterms should be available and at least one of them support colour.

xterm -fg white -bg blue4
color_xterm -fg white -bg blue4
color-xterm -fg white -bg blue4
nxterm -fg white -bg blue4

where 'color_xterm' supports the colour version of 'ls'. This particular choice resembles the colours used on an SGI.

6.2 Virtual console.

You may modify the kernel once and for all, as well as providing a run-time default for the virtual consoles with an escape sequence. I recommend the kernel patch if you have compiled your own kernel.

The kernel source file is /usr/src/linux/drivers/char/console.c around line 1940, where you should modify

        def_color       = 0x07;   /* white */
        ulcolor         = 0x0f;   /* bold white */
        halfcolor       = 0x08;   /* grey */
as appropriate. I use white on blue with
        def_color       = 0x17;   /* white */
        ulcolor         = 0x1f;   /* bold white */
        halfcolor       = 0x18;   /* grey */

The numbers are the attribute codes used by the video card in hexadecimal: the most significant digit (the "1" in the example colours above) is the background; the least significant the foreground. 0 = black, 1 = blue, 2 = green, 3 = cyan, 4 = red, 5 = purple, 6 = brown/yellow, 7 = white. Add 8 to get "bright" colours. Note that, in most cases, a bright background == blinking characters, dull background. (From

You may also supply a new run-time default for a virtual console, on a per-display basis with the non-standard ANSI sequence (found by browsing the kernel sources)

        ESC [ 8 ]

which sets the default to the current fore- and background colours. Then the Reset Attributes string (ESC [ m) selects these colours instead of white on black.

You will need to actually echo this string to the console each time you reboot. Depending on what you use your Linux box for, several places may be appropriate:


This is where "Welcome to Linux xx.yy" is displayed under Slackware, and that is a good choice for stand-alone equipment (and probably be a pestilence for users logging in with telnet). This file is created at boottime (Slackware in /etc/rc.d/rc.S; Redhat in /etc/rc.d/rc.local), and you should modify lines looking somewhat like

  echo ""> /etc/issue
  echo Welcome to Linux `/bin/uname -a | /bin/cut -d\  -f3`. >> /etc/issue
  ESCAPE="<replace with a single escape character here>"
  echo "${ESCAPE}[H${ESCAPE}[37;44m${ESCAPE}[8]${ESCAPE}[2J"> /etc/issue
  echo Welcome to Linux `/bin/uname -a | /bin/cut -d\  -f3`. >> /etc/issue

This code will home the cursor, set the colour (here white on blue), save this selection and clean the rest of the screen. The modification takes effect after the next reboot. Remember to insert the _literal_ escape character in the file with C-q in emacs or control-v in vi, as apparently the sh used for executing this script does not understand the /033 syntax.

/etc/profile or .profile

  if [ "$TERM" = "console" ]; then
      echo "\033[37;44m\033[8]" #
# or use setterm.
      setterm -foreground white -background blue -store

/etc/login or .login

  if ( "$TERM" == "console" ) then
    echo "\033[37;44m\033[8]"  
# or use setterm.
      setterm -foreground white -background blue -store

6.3 Remote login

You should be able to use the setterm program as shown above. Again, this requires that the remote machine knows enough about your terminal, and that the terminal emulator providing the login supports colour. In my experience the best vt100 emulation currently available for other platforms are:

See for details about Kermit.

Previous Next Contents