Previous Table of Contents Next


Module 126
stty

DESCRIPTION

The external stty command sets terminal I/O options for the standard input device. Your standard input device is usually a /dev/ptyXX device driver. If you are on a network, it might be a /dev/ttyXX device driver. Regardless of how you are connected to the UNIX operating system, you have a terminal I/O device driver. The stty command can be used to set and reset how the "tty" device driver functions.

The most common use of the stty command is to reset your erase and kill characters. Some people reset a few other options, but for the most part, the default settings handle all of the typical user's requirements.

COMMAND FORMAT

Following is the general format of the stty command.

     stty [ -ag ] terminal-options

BSD (Berkeley)
stty terminal_options

Options

The following options may be used to control how stty functions.

-a Displays all terminal option settings.
-g Displays the current terminal option settings in a format you can use as an argument to another stty command.

Option Arguments

The following are special arguments that perform option type functions on BSD.


BSD (Berkeley)
all Displays all normally used options.
everything Displays every setting stty knows about.
speed Displays the terminal/line speed (baud rate).
size Displays the number of rows and columns on the terminal.

Arguments

The following list describes the arguments that may be passed to the stty command. These arguments are referred to as terminal-options. The terminal options enclosed in parentheses are the opposite settings. For example, ocrnl maps Return to new-line and (-ocrnl) unmaps Return to new-line. Not all terminal options have two settings.


NOTE:  
Only the more common terminal-options are discussed. For a complete list refer to your vendor's User's Reference Manual.



Control Modes  These terminal options control how your terminal and the computer communicate. Most of these options are set automatically when you log in to the system. Resetting these options may cause your terminal to perform strangely and/or even hang or disconnect.

0 Causes the device driver to hang up (disconnect) the phone immediately.
baud Sets the baud rate of the device driver to baud. Supported baud rates vary depending on the hardware terminal interface boards. The baud rate must match the baud rate of your terminal. Popular baud rates are: 110, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400.
csn Sets the character size to be n bits. It takes 7 bits to create one ASCII character. This size is used for transmitting the characters between your terminal and the system. The parity bit is not included in the character size.
hup (-hup)
 hupcl (-hupcl)
Causes the terminal device driver to hang up (do not hang up) the phone when the last process attached to the device terminates. For example, when you log off the system your shell terminates and the driver hangs up the phone line automatically.

BSD (Berkeley)
0 Same as SV
baud Same as SV
new Enable new tty device driver.
nohang (-nohang) Do not (do) send hang-up signal if carrier drops.
pass8 All 8 bits are passed through on input.
(-pass8) Strips the 0200 bit on input except in raw mode.
tandem (-tandem) Enable (disable) flow control.
tostop Background jobs stop if they attempt to write to the terminal (standard output). Like loblk on SV.
(-tostop) Output from background jobs is allowed to the terminal.

Input Modes  These settings are used to control how the device driver responds to certain character sequences received from your terminal keyboard. If you press a key on your terminal or if the line has noise on it, these options can be set to detect or ignore the signals.

brkint (-brkint) The device driver sends (does not send) an interrupt signal to your current program on the UNIX system when you press the break key on your terminal.
icrnl (-icrnl) Converts (does not convert) the ASCII CR (carriage return) character to the ASCII NL (new-line) character on input.
ignbrk (-ignbrk) Ignores (does not ignore) the break signal on input. The break signal is produced on your terminal by pressing the break key.
igncr (-igncr) Ignores (does not ignore) the ASCII CR (carriage return) character on input.
ignpar (-ignpar) Ignores (does not ignore) parity errors. If parity is enabled then each character is checked for the correct parity.
inlcr (-inlcr) Converts (does not convert) the ASCII NL (new-line) character to the ASCII CR (carriage return) character on input.
inpck (-inpck) Enables (disables) parity checking on input bytes.
istrip (-istrip) Strips (does not strip) the high order bit from the input character. The input bit is thus reduced to seven bits. The normal ASCII character set is made up of only seven bits. The eighth bit is needed for extended ASCII or hardware that can utilize the eighth bit.
iuclc (-iuclc) Converts (does not convert) uppercase characters to lowercase characters on input.
ixany (-ixany) Enables (disables) any input character to cause output that has been suspended with the stop character (Ctrl-S) to resume.
ixoff (-ixoff) Enables (disables) input start and stop flow control. The system and the modem use the start and stop characters to control character trans- missions. When the input queue is almost empty, the system sends a start character. When the input queue is almost full, the system sends a stop character.
ixon (-ixon) Enables (disables) the keyboard to control output flow control. This allows you to start and stop output to your screen using the Ctrl-S (stop) and Ctrl-Q (start) characters. The Ctrl-S stops output and the Ctrl-Q resumes output.

BSD (Berkeley)
None of the above settings are supported in BSD. BSD implements the following settings.
decctlq (-decctlq) After output is suspended, usually by Ctrl-S, only the start character (any character), usually Ctrl-Q, will start the output.
pendin (-pendin) Input is (not) pending. A switch has occurred from cbreak to cooked and input is waiting. It is re-input by the driver when a new read becomes available from the application program.

Output Modes &nbspThese terminal options control the sending of data from the computer to your terminal screen.

ocrnl (-ocrnl) Converts (does not convert) an ASCII CR (carriage return) to an ASCII NL (new-line) on output.
olcuc (-olcuc) Converts (does not convert) lowercase characters to uppercase characters on output.
onlcr (-onlcr) Converts (does not convert) an ASCII NL (new-line) to an ASCII CR (carriage return) on output.
onlret (-onlret) Maps (does not map) the ASCII NL (new-line) character to be the CR-NL (carriage return, new-line) character sequence on output. The carriage return causes the cursor to return to the beginning of the line. The new-line forces the cursor to the next line. If the - (hyphen) is used then the cursor moves to the next line but does not return to the beginning of the line.
onocr (-onocr) Does not (does) transmit the ASCII CR (carriage return) character when it is the first character on the output line.
opost (-opost) Post-processes (does not post-process) the output sent from the computer. The post-processing refers to the conversions and mappings performed by the other Output Modes discussed in this section. If post-processing is not performed, all output is transmitted unchanged.

BSD (Berkeley)
None of the standard output modes are supported by BSD.
flusho (-flusho) The output is (not) being discarded. Usually caused by the user pressing Ctrl-O.
litout (-litout) Do not (do) perform output processing. Normal output processing involves inserting delays, timing sequences, and other control sequences.


Previous Table of Contents Next