setterm
Set terminal attributes
SYNOPSIS
setterm [options]
PARAMETERS
-reset
Resets the terminal to its default settings.
-term
Specifies the terminal type (e.g., linux, xterm, vt100).
-cursor {on | off}
Turns the cursor on or off.
-foreground
Sets the foreground color. Colors can be specified by name (e.g., red, blue, green) or by number.
-background
Sets the background color. Colors can be specified by name or number.
-bold {on | off}
Enables or disables bold text.
-underline {on | off}
Enables or disables underlined text.
-blink {on | off}
Enables or disables blinking text.
-reverse {on | off}
Enables or disables reverse video (swaps foreground and background colors).
-store
Saves the current terminal settings to the kernel for future use.
-blank
Sets the screen blanking timeout in minutes. A value of 0 disables blanking.
-powersave {on | off | vsync | hsync | powerdown}
Enables or disables power saving features or specifies a specific power saving mode.
-initchr
Sets the initial character to be displayed on the screen.
-linewrap {on | off}
Enables or disables line wrapping.
-appcursorkeys {on | off}
Sets the application cursor keys mode.
-appkeypad {on | off}
Sets the application keypad mode.
-altcur {on | off}
Use alternate (block) cursor shape.
-regalwaysoff
Turn the Always-Off feature for VGA registers to OFF.
-default
Restores only the colours (foreground, background, bold) to their defaults.
-file
Reopen stdin on the given file.
-version
Show the version number of the program.
-help
Display help text and exit.
DESCRIPTION
The setterm command is a utility for setting various attributes of a terminal. It allows you to control aspects such as cursor appearance, terminal colors, character attributes (bold, underline, blink), screen blanking, keyboard behavior, and more. setterm is primarily used in scripts or interactive sessions to customize the terminal environment.
Its versatility makes it useful for creating visually appealing terminal interfaces, managing power saving features like screen blanking, and configuring keyboard behavior to suit specific needs. setterm often interacts directly with the kernel to control the terminal device, providing a low-level interface for customization.
While graphical terminal emulators often offer built-in settings panels, setterm provides a command-line alternative, enabling scripting and automation of terminal configurations.
CAVEATS
setterm may not work correctly in all terminal environments, especially graphical terminal emulators which may override some settings. Some options require root privileges. The effects of setterm are usually only temporary and reset when the terminal is closed or a new login session is started. For persistent changes, modify terminal configuration files (e.g., .bashrc, .profile).
COLOR NAMES
Color names such as red, green, blue, black, white, cyan, magenta, yellow are supported, though the exact colors displayed may vary depending on the terminal.
USAGE EXAMPLES
- To set the foreground color to green: setterm -foreground green
- To disable screen blanking: setterm -blank 0
- To enable bold text: setterm -bold on