STTY(1)

NAME
stty - set or display terminal options

SYNOPSIS
stty [ option ... ]
stty [ option ... ] > /dev/tty??
stty [ option ... ] > file
stty [ option ... ] | ...

DESCRIPTION
Stty sets options on (or displays options for) a terminal.

If standard output is a terminal, then the options are set (or displayed) and any output is sent to standard error. If standard output is not a terminal (eg a file or a pipe) then the options of the current terminal (ie /dev/tty) are set (or displayed) and any output is sent to standard output (the file or pipe).
In most cases this is the expected behaviour, though it is not standard in BSD 4.3.

Note: this version of stty provides the same style of interface for terminal control as standard BSD 4.3 and earlier releases of RISC iX (albeit with minor modifications). There is an alternative version of stty which implements the X/Open XPG3 interface and more closely reflects the underlying kernel facilities, available as /usr/5bin/stty; see stty(1v).

With no argument, stty reports the speed of the terminal and the settings of the options which are different from their defaults. Use of one of the following options modifies the output as described:

all All normally used option settings are reported.

everything
    Everything stty knows about is printed.

speed
    The terminal speed alone is printed.

size
    The terminal (window) sizes are printed. first rows and then columns.

    The option strings are selected from the following set:

even
    allow even parity input

-even
    disallow even parity input

odd allow odd parity input

-odd
    disallow odd parity input

raw raw mode input (no input processing (erase, kill, interrupt, ...); parity bit passed back)

-raw
    negate raw mode

cooked
    same as `-raw'

cbreak
    make each character available to read(2) as received; no erase and kill processing, but all other processing (interrupt, suspend, ...) is performed

-cbreak
    make characters available to read only when newline is received

-nl allow carriage return for new-line, and output CR-LF for carriage return or new-line

nl  accept only new-line to end lines

echo
    echo back every character typed

-echo
    do not echo characters

lcase
    map upper case to lower case

-lcase
    do not map case

tandem
    enable flow control, so that the system sends out the stop character when its internal queue is in danger of overflowing on input, and sends the start character when it is ready to accept further input

-tandem
    disable flow control

-tabs
    replace tabs by spaces when printing

tabs
    preserve tabs

ek  set erase and kill characters to # and @

For the following commands which take a character argument c, you may also specify c as ``u'' or ``undef'', to set the value to be undefined. A value of ``^x'', a 2 character sequence, is also interpreted as a control character, with ``^?'' representing delete.

erase c
    set erase character to c (default ^?, but often reset to ^H)

kill c
    set kill character to c (default ^U)

intr c
    set interrupt character to c (default ^C, but sometimes reset to ^?)

quit c
    set quit character to c (default control \)

start c
    set start character to c (default control Q)

stop c
    set stop character to c (default control S)

eof c
    set end of file character to c (default control D)

brk c
    set break character to c (default undefined) - this character acts as an alternative line terminator

cr0 cr1 cr2 cr3
    select style of delay for carriage return (see ioctl(2))

nl0 nl1 nl2 nl3
    select style of delay for linefeed

tab0 tab1 tab2
    select style of delay for tab

ff0 ff1
    select style of delay for form feed

bs0 bs1
    select style of delay for backspace

tty33
    set all modes suitable for the Teletype Corporation Model 33 terminal

tty37
    set all modes suitable for the Teletype Corporation Model 37 terminal

vt05
    set all modes suitable for Digital Equipment Corp. VT05 terminal

dec set all modes suitable for users familiar with DEC operating systems (erase, kill, and interrupt characters to ^?, ^U, and ^C, decctlq and ``newcrt'')

tn300
    set all modes suitable for a General Electric TermiNet 300

ti700
    set all modes suitable for Texas Instruments 700 series terminal

tek set all modes suitable for Tektronix 4014 terminal

0   hang up phone line immediately

50 75 110 134 150 200 300 600 1200 1800

2400 4800 9600 19200 exta 38400 extb
    Set terminal baud rate to the number given, if possible, where ``exta'' is synonymous with 19200 and ``extb'' with 38400.

rows n
    The terminal size is recorded as having n rows.

columns n
    The terminal size is recorded as having n columns.

cols n
    is an alias for columns.

A terminal interface line discipline which supports the job control processing of csh(1) and more functionality than the basic driver is fully described in tty(4), and is referred to as the ``new'' driver (or line discipline). In addition, a variant of the new driver, referred to as the ``posix'' driver, is available. It implements a tty interface which is fully compliant with POSIX and X/Open specifications, but is also very largely backwards compatible with the new line discipline. The following commands allow switching between the three supported line disciplines; switching causes any typeahead to be flushed:

new Use new driver

old Use original (V7 style) driver

posix
    Use posix driver. Under this line discipline, certain features of the interface provide slightly more security than for the old or new drivers. For this reason, to permit such security measures to be effective, it is possible for a tty to be locked into the posix line discipline (see description of posixlock below).

The following options apply to the new and posix drivers only:

posixlock
    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. If secure posix mode use is desired, the command:
    	stty posix posixlock > tty-name
    should be added to /etc/rc.local.

-posixlock
    Disable posix line discipline locking. This option will only take effect if exercised by the super-user.

crt Set options for a CRT (crtbs, ctlecho and, if >= 1200 baud, crterase and crtkill).

crtbs
    Echo backspaces on erase characters.

prterase
    For printing terminal echo erased characters backwards within ``\'' and ``/''.

crterase
    Wipe out erased characters with ``backspace-space-backspace.''

-crterase
    Leave erased characters visible; just backspace.

crtkill
    Wipe out input on line kill ala crterase.

-crtkill
    Just echo line kill character and a newline on line kill.

ctlecho
    Echo control characters as ``^x'' (and delete as ``^?''.) Print two backspaces following the EOT character (^D by default).

-ctlecho
    Control characters echo as themselves; in cooked mode EOT (^D) is not echoed.

decctlq
    After output is suspended (normally by ^S), only a start character (normally ^Q) will restart it. This is compatible with DEC's vendor supplied systems.

-decctlq
    After output is suspended, any character typed will restart it; the start character will restart output without providing any input. (This is the default.)

tostop
    Background jobs stop if they attempt terminal output.

-tostop
    Output from background jobs to the terminal is allowed.

tilde
    Convert ``~'' to ```'' on output (for Hazeltine terminals).

-tilde
    Leave poor ``~'' alone.

flusho
    Output is being discarded usually because user hit control O (internal state bit).

-flusho
    Output is not being discarded.

pendin
    Input is pending after a switch from cbreak to cooked and will be re-input when a read becomes pending or more input arrives (internal state bit).

-pendin
    Input is not pending.

pass8
    Passes all 8 bits through on input, in any mode.

-pass8
    Strips the 0200 bit on input except in raw mode.

mdmbuf
    Start/stop output on carrier transitions (not implemented).

-mdmbuf
    Return error if write attempted after carrier drops.

litout
    Send output characters without any processing.

-litout
    Do normal output processing, inserting delays, etc.

nohang
    Don't send hangup signal if carrier drops.

-nohang
    Send hangup signal to control process group when carrier drops.

The following special characters are applicable only to the new or posix teletype drivers 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 for all but the suspend process character is ``undefined'', i.e. the remaining special functions are by default disabled.

susp c
    set suspend process character to c (^Z).

dsusp c
    set delayed suspend process character to c (^Y)

rprnt c
    set reprint line character to c (^R)

flush c
    set flush output character to c (^O)

werase c
    set word erase character to c (^W)

lnext c
    set literal next character to c (^V)

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

SEE ALSO
stty (1v), ioctl(2), tabs(1), tset(1), tty(4)