STTY(1)

NAME
stty - set or display terminal options

SYNOPSIS
/usr/5bin/stty
/usr/5bin/stty -a
/usr/5bin/stty -g
/usr/5bin/stty option ...

DESCRIPTION
Stty sets options on, or displays current options for, its standard input, which must be a terminal. The command conforms to the X/Open XPG3 definition with the exception of the XPG3 `loblk' option which is not part of the POSIX terminal interface, or relevant to RISC iX, and is hence unsupported. Further options allow control of the kernel extensions to the basic POSIX and X/Open terminal interface, for backwards compatibility with earlier versions of RISC iX, and BSD 4.3.

The original BSD 4.3 style of terminal control is also available, see stty(1). Note however that /usr/5bin/stty itself provides support for all the traditional features of BSD terminal control, and allows finer adjustment of the interface than is possible using /usr/bin/stty.

With no argument, stty reports the speed of the terminal and the values of some frequently referenced options, along with the values of other options which are different from their default. If the flag -a is provided, all available information about the state of the terminal is displayed.

The flag -g by itself causes a single encoded parameter string to be printed on standard output representing the full current state of the terminal in a compact format. Such a string may later be passed as an option to another stty command, and all terminal characteristics will be set as specified in the string. In this way the existing set-up of a terminal can be quickly replicated or reinstated.

Otherwise particular characteristics of the terminal interface are set according to the supplied option string(s), selected from the set below. Options are processed in order of appearance in the argument list - the last occurence of a particular option will be the one which takes effect. Many options are simple boolean items, for which -option is the inverse of option.

if <linecode> is a number in the range 0 through 127, attempt to select that line discipline; the system will reject attempts to select unsupported line disciplines, but note that some supported line disciplines are designed for use only with specific special devices and may cause serious difficulties for an interactive user if selected on a normal terminal device. There are three line disciplines which are designed for interactive terminal use; for these, a textual name (rather than a number) may be supplied as the value of <linecode>, as show below. (equivalent to line 0) select the original (V7 UNIX) style of line discipline - this is now little used because of its minimal functionality; in particular it does not support job control select the standard BSD 4.3 style of line discipline, including full job control and other features; this is the default for users of csh(1), and is recommended for general backwards compatibility with earlier versions of RISC iX select a full POSIX-compliant line discipline, under which extra security checks are applied to some of the control operations specific to the job control facilities. For this reason it may not always be possible to run applications written to work with the original BSD 4.3 job control facilities, or they may behave in an odd way. To enhance security, it is possible for a tty to be locked into the posix line discipline (see description of posixlock below). force posix line discipline to remain in force (once set) on the tty until this option is turned off (using -posixlock). This option will only take effect if exercised by the super-user. If the tty is not in posix mode at the time posixlock is set, it may still be switched between other line disciplines by an unprivileged user, up until the time that posix line discipline is set. Thereafter only the super-user may take the tty out of posix mode or clear the posixlock option, even if the tty is closed. disable posix line discipline locking; this option will only take effect if exercised by the super-user.

enable parity generation and detection in the hardware interface (if supported), i.e. a parity bit will be sent with each transmitted character, and parity information will be extracted from incoming data disable hardware parity generation and detection if parenb is set, the hardware will transmit and expect to receive characters with odd parity if parenb is set, the hardware will transmit, and expect to receive, characters with even parity set the number of bits of actual data for hardware transmission or reception to 8, 7, 6 or 5 respectively (insofar as the hardware supports this); this setting is independent of the state of parenb set the number of stop bits transmitted at the end of each character frame to 2 (normally only used for 110 baud working) set the number of stop bits transmitted as the end of each character frame to 1 (the common setting) composite option equivalent to parenb cs7 -parodd composite option equivalent to -parenb cs8 composite option equivalent to parenb cs7 -parodd composite option equivalent to -parenb cs8 composite option equivalent to parenb cs7 parodd composite option equivalent to -parenb -parodd cs7 enable software checking for parity error on input (meaningful only if parenb is also set) if the hardware interface is attached to a modem, cause a disconnection to be performed, i.e. ``hang up'' the line set the baud rate of the serial line interface to the specified value, where 134 is synonymous with 134.5, 19.2 with 19200 and 38.4 with 38400; if the specified baud rate is not supported by the hardware or associated device driver, the command will fail when the terminal is closed (e.g. by logout from an interactive session) perform a modem disconnect as for the 0 option do not perform a modem disconnect when the terminal is closed for a terminal interface with modem interface capability, ignore the state of the modem control signals on the interface, i.e. treat the line as a purely local connection to a directly attached terminal device interpret the modem interface control signals (if supported) so that operations on the terminal will be regulated by e.g. the presence of the carrier signal on a modem line

ignore received line breaks treat received line breaks according to the settings of brkint and parmrk if ignbrk is not set, line breaks generate an interrupt (SIGINT) and cause all queued input and output to be discarded if ignbrk is not set, received line breaks generate input data as determined by the setting of parmrk enable any input data received at the device to be read by a process having the device open disable the reception of input data from the terminal; this may be useful if a serial port is being used only for data output (e.g. using a hardcopy terminal as a printer), so that any input received at the hardware interface will be completely ignored and cannot interfere with the processing of output data incoming characters will be masked to 7 bits before they are read by a process; this is independent of the selected hardware character size do not mask incoming characters to 7 bits enable software checking for parity error on input (meaningful only if parenb is also set) disable software checking on input parity; this operates independently of hardware parity, i.e. parenb controls the data format transmitted or received, inpck controls whether parity errors are considered significant if parenb and inpck are both set, discard (ignore) incoming characters which are found to have the wrong parity if parenb and inpck are both set, pass characters with the wrong parity through to a process reading from the terminal, in a form determined by the value of parmrk if ignbrk and brkint are both unset, pass received line break conditions to a reading process as a sequence of three bytes having values 0377, 0, 0; also, if parenb and inpck are set and ignpar is not set, pass characters received with invalid parity (or with any framing error apart from line break) to a reading process as a sequence of three bytes 0377, 0, X, where X is the value of the erroneous character data supplied by the hardware; in the latter case, if istrip is not set, a valid received character of value 0377 will be passed to the reading process as a two byte sequence 0377, 0377, so as to avoid ambiguity if ignbrk and brkint are both unset, pass received line break conditions to a reading process as a single byte of value 0 (NUL); also, if parenb and inpck are set and ignpar is clear, pass characters received with incorrect parity to a reading process as a single byte of value 0 (NUL) cause signals to be generated by the input of any of the special characters intr, quit, susp and dsusp (dsusp causes signal generation when it is read by a process rather than when it is received) prevent the generation of signals by any of the special characters which would normally do so prevent the flushing of input and output queues which would otherwise take place when receipt of intr, quit and susp causes a signal to be generated flush the input and output queues when receipt of any of intr, quit or susp causes a signal to be generated enable echo of characters as received; the precise way this echoing is done is controlled by the remaining input options, below no characters are echoed as received, except possibly the newline character, whose echoing is separately controlled by echonl echo the newline character, even if echo is not set newline does not receive special echo treatment echo the erase character using BS-SP-BS which will cause the preceding character to be wiped out (suitable for use on a video display terminal) do not wipe out erased characters when a line is killed with the kill character, echo the character and start a new line when a line is killed, nothing is echoed to mark the effect, unless some other line-related echo option (e.g. echoke) would cause this use a mode of character erasure suitable for a hardcopy device: characters are re-echoed in order of deletion, deleted characters being surrounded by ``\'' and ``/'' do not use the hard-copy style erase echoing for line kill, use the echoe mode of erase for each character, wiping out the line completely from the display rather than just taking a new one if a line is killed, do not wipe it out control characters which are not special (or are quoted via lnextc) are echoed in the form ``^x'' where x is a printable ASCII character in the range `@' through `_' for control character codes in the range 0 through 31, or `?' for ASCII DEL (code 127); if the control character is in the upper half of the full 8-bit character range (i.e. 128..159) then the form ``|x'' is used instead; when the eof character (default EOT, ^D) is echoed in this mode, it will be backspaced over so that subsequent output (other than a newline) will overwrite it. echo control characters back without translation; if the opost and noeot options are both set then EOT (^D) will not be echoed at all set echo options suitable for interactive use on a video terminal (echoe echok echoke echoctl) set echo options suitable for interactive use on a hardcopy device (echoprt echoctl -echoe -echoke) set the terminal into canonical input mode, where line editing is possible using the erase, kill and werase characters, and where the newline, eol and eof characters terminate an input line and make it available to a process reading from the terminal; the backslash character may be used as a prefix to escape the erase, kill, werase and eof characters, if they are to be input without their special meaning set the terminal into non-canonical mode (not normally used from the command line); in this mode, line editing is not available (the erase, kill and werase characters are not treated specially), and input typed becomes available to a reading process immediately - the newline, eof and eol characters cease to have any special effect as line terminators; also in this mode, the min and time special values are used to control the behaviour of the read(2) function when applied to the terminal convert received ASCII CR (Carriage Return) characters into newline characters (NL, ASCII LF) leave received CR characters alone (unless igncr is set) ignore received CR characters completely accept received CR characters, treating them according to the setting of icrnl convert received NL (ASCII LF) characters into CR characters leave received NL characters as they are convert received upper case characters (A-Z) to lower case (only applicable if iexten is set) do not convert received upper case characters to lower case enable extended input input options, i.e. those features which are not specified in the POSIX standard (IEEE 1003.1); this option is normally set, and it must be set for the iuclc and ixany flags, and the werase, dsusp, reprint, flush and lnext special characters to be effective disable input processing extensions: only those input options and special characters defined by IEEE 1003.1 will be recognised

apply flow control to output: if the stop character (default ^S) is received as input, output will be suspended as soon as possible; if the start character (default ^Q) is then typed, output will be restarted - this allows user control of scrolling when large amounts of text are being displayed, and is also useful when the output device is not a user terminal but a hardware periperal (or another computer) which requires that its rate of data input be moderated disable flow control of output; the start and stop characters will not be checked for on reception of input data, i.e. they are not treated as special if ixon is set, allow any input character (not just the start character) to restart output which was suspended by the stop character (only applicable if iexten is set) allow only the start character to restart stopped output apply flow control to input - normally only used when the interface is attached to a special peripheral or another computer which can generate high rates of data as input; if the level of input data queued for reading exceeds a certain threshold (normally 127 bytes), a stop character will be transmitted to the other end for each received input character, until the input level drops again; should the input level subsequently exceed a second, higher threshold (normally 255), all unprocessed input data will be silently discarded and a start character transmitted - this should be an exceptional event for a properly configured connection. use modem control signals to perform output flow control do not use modem signals to perform output flow control

a background job attempting to write to the terminal will be sent a signal SIGTTOU which will normally stop the job a background job is permitted to write to the terminal

perform output processing controlled by the remaining output options do not perform any output processing, all other output options are ignored convert the newline character (NL) to the two characters CR, NL on output leave the newline character as itself on output convert the CR character to newline (NL) on output leave CR alone as itself on output do not send CR characters when the output device is at column 0 always output a CR character when requested indicates that the terminal performs the full newline function (including moving to column 0) when it is sent the NL character: this allows the terminal driver to keep track of column position indicates that the terminal does not move to column 0 when a NL is sent to it when the tilde character (~) is to be output or echoed, transmit the backquote character (`) instead; this option is required for some Hazeltine terminals which do not display the tilde character output the tilde character with no special treatment the ASCII character EOT (code 4, ^D) will be filtered from any output or echoed data; this is intended to protect against the unpleasant effects this code can cause on some types of terminal do not perform any filtering on the EOT character when output or echoed, upper case characters are preceded by a backslash (to distinguish them from lower-case characters converted to upper case with olcuc) and the other characters (`{', `|', `}' and `~') not printable by some older terminals are displayed as respectively `\(', `\!', `\)' and `\^'; this option is normally used only in conjunction with olcuc and iuclc upper case letters and the other characters described under xcase will be displayed without special treatment

The following options control the treatment of certain characters when output or echoed to the terminal; for some hardcopy terminals, it is necessary to give them extra time to perform the physical operations associated with certain control characters (BS, CR, FF, NL, TAB, VT). This is achieved either by simplying delaying further output following the transmission of the character, or by sending padding characters (which will be ignored by the terminal) for the specified length of time. For each character, exactly one of the available delay options will be applied, i.e. these are 1-of-n options rather than individual boolean flags; if the chosen option ends in 0 then no delay will be applied for that character. The exact delays generated are controlled by the terminal driver and are not optimal for all devices; all delay times given below are approximate. Note that when stty -g is used, only delay options with a value other than 0 are displayed.

delay inserted after BS is output: bs1 gives a delay of 60ms delay when CR is output: for cr1, delay is related to column position before the CR is sent - if at column 0, there is no delay, otherwise the delay varies between 70ms and 100ms with increasing column position; cr2 gives a delay of 90ms; cr3 a delay of 130ms delay when FF (Form Feed) is output; ff1 gives a delay of 1.3 seconds delay when NL (newline, ASCII LF, Line Feed) is output; nl1 gives a delay of 90ms, but if onlret is set than the current CR delay will be used instead of the NL delay when NL is output treatment of tabs: tab0 or tabs means that TAB is simply passed to the terminal with no delay; tab1 gives a delay related to how much motion the TAB will cause (assuming that TAB moves to the next 8-column multiple): if the distance is less than five columns then no delay is used, otherwise the delay varies from 90ms through 120ms; tab2 gives a constant delay of 60ms; tab3 is special in that it does not generate a delay but rather causes the normal effect of TAB on output to be simulated by converting it to a sequence of from 1 to 8 spaces according to the current column position; -tabs and tab8 are equivalent to tab3 delay when the VT character (Vertical Tab) is output; vt1 gives a delay of 1.3 seconds causes delays to be implemented by transmitting padding characters during the delay period causes delays to be implemented by simply transmitting no data during the delay period if ofill is set then ASCII DEL (code 127 decimal) will be used as the padding character if ofill is set then ASCII NUL (code 0) will be used as the padding character

set options suitable for a terminal which generates NL (LF) as its normal newline character and handles NL (LF) by performing the normal newline display function; this is equivalent to (-icrnl -onlcr). set options suitable for a terminal which generates CR as its normal newline character and requires to receive CR along with NL (LF) to perform the newline display function; equivalent to (icrnl onlcr -inlcr -igncr -ocrnl -onlret) set terminal into ``raw'' mode: the data format is set to 8 bits wide with no parity, no signals are generated by input characters, non-canonical input mode is established and no output post-processing is done set all options suitable for a terminal which does not generate or display lower case characters; equivalent to (iuclc xcase olcuc) set options for a terminal which can generate and display both upper and lower case characters; equivalent to (-iuclc -xcase -olcuc) set normal input and output options, reversing the effect of raw set the erase and kill characters to their defaults (^? and ^U respectively) set terminal options to a generally ``sensible'' state

The special characters for the terminal can be changed by supplying an option comprised of two command arguments: ``specname code'' where specname is one of the names listed below, and code is either just the code itself given literally as a single-character argument, or has the form ``^x'' where x is in the range `@' through `_' for control codes in the range 0 through 31, or `?' for control code 127 (ASCII DEL), or `-' to mean that the special character action should be disabled, i.e. no received character will be recognised as performing the special function. Default values are shown in parentheses. The start and stop characters are displayed using this format for the command stty -g, but are (currently) not modifiable using stty.

character used to cause generation of SIGINT, the normal program interrupt signal (^C) character used to cause generation of SIGQUIT (^ character used to rubout the previous character on the input line, if any (DEL, ^?) character used to cause the whole of the input line entered so far to be discarded (^U) character used to simulate End-Of-File to a process reading from a terminal (^D) alternative end-of-line character (undefined)

The following special characters are functional only when the new or posix line disciplines are being used, and are not normally changed. The normal default values are shown in parentheses for each character; however if the terminal is locked into posix mode, the default setting (established when the terminal is opened) for all of the following characters except the susp character is that it is undefined, i.e. the special function is disabled. In the latter situation, stty may of course still be used to set these characters to a particular desired value. For all of the following options apart from susp, the special function is disabled if the iexten flag is not set, as these are extensions to the IEEE 1003.1 set of special characters.

character used to toggle the temporary discarding of output; flushing is terminated automatically by echo of a character or by a process performing a read from the terminal (^O) character used to cause all input not yet read by a process to be re-echoed to the terminal; typically used when echoing of the current input line has been confused by output written to the terminal (^R) character used to suspend execution of the foreground job, when job control (^Z) is in use character used to suspend execution of the foreground job at the point where the special character would be read as input (^Y) character used to cause the previous `word' on the current input line; a word is any group of characters delimited by spaces or tabs (^W) character used to prevent any special interpretation of the character it precedes; used to input otherwise special characters as ordinary data (^V)

Two special values for the terminal can be changed by supplying an option comprised of two command arguments: ``specname value'' where specname is one of min or time, and value is a number in the range 0 through 255. The two special values define the behaviour of the read(2) system call when the terminal is in non-canonical mode (-icanon). Note that it is uncommon to actually set these values using stty, rather they are typically set up by programs which need to handle character input in a special way (e.g. screen editors). Refer to the POSIX (IEEE 1003.1) standard or the X/Open Portability Guide for a fuller explanation of the treatment of these two values,

The following options are not normally modified by, or of interest to, ordinary users; they relate to internal state of the terminal driver, and are typically of use only in system diagnosis.

data written to the terminal is being flushed (discarded); this occurs when the terminal user has typed the flush character data sent to the terminal (or echoed) will appear as output; this is the normal state when the state of the terminal is switched between canonical and non-canonical input, any already queued data is marked to be re-input on the next read(2) operation or when further input arrives; this state only holds while re-input is pending no re-input of characters is pending

LIMITATIONS

There is no separate control over input and output speeds, even though commonly the hardware would allow them to be different.

The start and stop character values are displayed by the -a flag, but there is no option to change them, even though the underlying driver supports this.

There is no means to access the window size information maintained by the system for each attached terminal (the BSD stty(1) command gives access to this information).

SEE ALSO
stty (1v), ioctl(2), tabs(1), tset(1), tty(4)
X/Open Portability Guide Issue 3, volumes 1 and 2.