Tweaking the Linux Console

One of the main programs used for tweaking the console is setterm. It “writes to standard output a character string that will invoke the specified terminal capabilities. Where possible terminfo database (terminfo is a data base describing terminals, used by screen-oriented programs and libraries such as ncurses) is consulted to find the string to use.”

Disable the Annoying PC Speaker

Add this to /etc/rc.local

/sbin/modprobe -r pcspkr

Disable Screen Blanking

By default Linux enables screen blanking, like in a desktop environment. You can disable it by running this in the console.

$ setterm -powersave off -blank 0

Or to permanently disable it, add this to /etc/rc.local

sh -c 'setterm -blank 0 -powersave off -powerdown 0 `< /dev/console >` /dev/console 2>&1'
xset s off > /dev/null 2>&1

Other Useful Options

Resets the terminal to its power on state:

$ setterm -reset

Alternatively, initialize terminal:

$ setterm -initialize

Turns the terminal’s cursor on or off:

$ setterm -cursor [on|off]

Turns automatic line-wrapping on or off (virtual consoles only)

$ setterm -linewrap [on|off]

Sets the foreground text color (virtual consoles only):

$ setterm -foreground blue

Sets the background text color (virtual consoles only):

$ setterm -background red

Enables or disables the sending of kernel printk() messages to the console (virtual consoles only). Useful if you get lots message from iptables firewall:

$ setterm -msg [on|off]

Sources

Article: Linux disable screen blanking