STTY(C) UNIX System V
Name
stty - sets the options for a terminal
Syntax
stty [ -a ] [ -g ] [ options ]
Description
stty sets certain terminal I/O options for the device that
is the current standard input; without arguments, it reports
the settings of certain options. With the -a option, stty
reports all of the option settings. The -g option causes
stty to output the current stty settings of the terminal as
a list of twelve hexadecimal numbers seperated by colons.
This output may be used as a command line argument to stty
to restore these settings later on. It is a more compact
form than stty -a. For example, the following shell script
uses stty -g to store the current stty settings, then turns
off character echo while reading a line of input. The
stored stty values are then restored to the terminal:
:
echo "Enter your secret code: \c"
old=`stty -g`
stty -echo intr ^a
read code
stty $old
The various modes are discussed in several groups that
follow. Detailed information about the modes listed in the
first four groups may be found in termio(M). options in the
last group are implemented using options in the previous
groups. Refer to vidi(C) for hardware specific information
that describes control modes for the video monitor and other
display devices.
Common Control Modes
parenb (-parenb)
Enables (disables) parity generation and detection.
parodd (-parodd)
Selects odd (even) parity.
cs5 cs6 cs7 cs8
Selects character size (see termio(M)).
0 Hangs up phone line immediately.
50 75 110 134 150 200 300 600
1200 1800 2400 4800 9600 19200
Sets terminal baud rate to the number given, if
possible.
ispeed 50 75 110 134 150
1200 1800 3400 4800 9600 19200
sets terminal output baud rate separately.
ospeed 50 75 110 134 150
1200 1800 3400 4800 9600 19200
sets terminal input baud rate separately.
hupcl (-hupcl)
Hangs up (does not hang up) phone connection on last
close.
hup (-hup)
Same as hupcl (-hupcl).
cstopb (-cstopb)
Uses two(one) stop bits per character.
cread (-cread)
Enables (disables) the receiver.
clocal (-clocal)
Assumes a line without (with) modem control.
ctsflow (-ctsflow)
Enables CTS protocol for a modem or non-modem line.
rtsflow (-rtsflow)
Enables RTS signaling for a modem or non-modem line.
Input Modes
ignbrk (-ignbrk)
Ignores (does not ignore) break on input.
brkint (-brkint)
Signals (does not signal) INTERRUPT on break.
ignpar (-ignpar)
Ignores (does not ignore) parity errors.
parmrk (-parmrk)
Marks (does not mark) parity errors (see tty(M)).
inpck (-inpck)
Enables (disables) input parity checking.
istrip (-istrip)
Strips (does not strip) input characters to 7 bits.
inlcr (-inlcr)
Maps (does not map) NL to CR on input.
igncr (-igncr)
Ignores (does not ignore) CR on input.
icrnl (-icrnl)
Maps (does not map) CR to NL on input.
iuclc (-iuclc)
Maps (does not map) uppercase alphabetics to lowercase
on input.
ixon (-ixon)
Enables (disables) START/STOP output control. Output
is stopped by sending an ASCII DC3 and started by
sending an ASCII DC1.
ixany (-ixany)
Allows any character (only DC1) to restart output.
ixoff (-ixoff)
Requests that the system send (not send) START/STOP
characters when the input queue is nearly empty/full.
Output Modes
opost (-opost)
Post-processes output (does not post-process output;
ignores all other output modes).
olcuc (-olcuc)
Maps (does not map) lowercase alphabetics to uppercase
on output.
onlcr (-onlcr)
Maps (does not map) NL to CR-NL on output.
ocrnl (-ocrnl)
Maps (does not map) CR to NL on output.
onocr (-onocr)
Does not (does) output CRs at column zero.
onlret (-onlret)
On the terminal NL performs (does not perform) the CR
function.
ofill (-ofill)
Uses fill characters (use timing) for delays.
ofdel (-ofdel)
Fill characters are DELETEs (NULs).
cr0 cr1 cr2 cr3
Selects style of delay for RETURNs (see tty(M)).
nl0 nl1
Selects style of delay for LINEFEEDs (see tty(M)).
tab0 tab1 tab2 tab3
Selects style of delay for horizontal TABs (see
tty(M)).
bs0 bs1
Selects style of delay for BACKSPACEs (see tty(M)).
ff0 ff1
Selects style of delay for FORMFEEDs (see tty(M)).
vt0 vt1
Selects style of delay for Vertical TABs (see tty(M)).
Local Modes
isig (-isig)
Enables (disables) the checking of characters against
the special control characters INTERRUPT and QUIT.
icanon (-icanon)
Enables (disables) canonical input (ERASE and KILL
processing).
xcase (-xcase)
Canonical (unprocessed) upper/lowercase presentation.
echo (-echo)
Echoes back (does not echo back) every character typed.
echoe (-echoe)
Echoes (does not echo) ERASE character as a SPACEBAR
string. Note: this mode will erase the ERASE character
on many CRT terminals; however, it does not keep track
of column position and, as a result, may be confusing
on escaped characters, TABs, and BACKSPACEs.
echok (-echok)
Echoes (does not echo) NL after KILL character.
lfkc (-lfkc)
The same as echok (-echok); obsolete.
echonl (-echonl)
Echoes (does not echo) NL.
noflsh (-noflsh)
Disables (enables) flush after INTERRUPT or QUIT.
iexten(-iexten)
Enables extended implementation (implementation-
defined) function.
tostop(-tostop)
Disables/enables background process group to write to
controlling terminal only if job control is supported.
Control Assignments
control-character C
control-character C Sets control-character to C, where
control-character is erase, kill, interrupt, quit, eof,
eol, switch, or susp If C is preceded by a caret (^)
(escaped from the shell), then the value used is the
corresponding CTRL character (e.g., ``^D'' is a CTRL-D
); ``^?'' is interpreted as DELETE and ``^-'' is
interpreted as undefined.
min i, time i (0<i<127)
When -icanon is set, and one character has been
received, read requests are not satisfied until at
least min characters have been received or the timeout
value time has expired and one character has been
received. See tty(C).
line i
Sets the line discipline to i (0 < i < 127 ). There are
currently no line disciplines implemented.
Combination Modes
evenp or parity
Enables parenb and cs7.
oddp Enables parenb, cs7, and parodd.
-parity, -evenp, or -oddp
Disables parenb, and sets cs8.
raw (-raw or cooked)
Enables (disables) raw input and output (no ERASE,
KILL, INTERRUPT, QUIT, EOT, or output post-processing).
nl (-nl)
Unsets (sets) icrnl, onlcr. In addition -nl unsets
inlcr, igncr, ocrnl, and onlret.
lcase (-lcase)
Sets (unsets) xcase, iuclc, and olcuc.
LCASE (-LCASE)
Same as lcase (-lcase).
tabs (-tabs or tab3)
Preserves (expands to spaces) tabs when printing.
ek Resets ERASE and KILL characters back to normal CTRL-H
and CTRL-U .
sane Resets all modes to some reasonable values. Useful
when a terminal's settings have been hopelessly
scrambled.
term Sets all modes suitable for the terminal type, TERM,
where TERM is one of tty33, tty37, vt05, tn300, ti700,
or tek.
See Also
console(M), ioctl(S), vidi(C), tty(M), termio(M), termios(M)
Notes
Many combinations of options make no sense, but no checking
is performed.
Standards Conformance
stty is conformant with:
AT&T SVID Issue 2, Select Code 307-127;
and The X/Open Portability Guide II of January 1987.
(printed 2/22/90) STTY(C)