stty(1)stty(1)Namestty - set terminal options
Syntaxstty [option...]
Description
The command sets or reports certain input/output characteristics of the
current output terminal. Output from the program is sent to the diag‐
nostic output (standard error). The command is used in two terminal
environments. The terminal environment is determined by the setting of
the terminal's line discipline. If the terminal's line discipline is
set to anything other than TERMIODISC (termio line discipline), refer
to the sections entitled "Non-Termio Operation" and "Non-Termio
Options." If your terminal line is set to the termio line discipline,
refer to the sections entitled "Termio Operation" and "Termio Options."
Note that you can use the command to find out the current line disci‐
pline of your terminal.
Non-termio Operation
With no argument, the command reports the speed of the terminal and the
settings of the options that are different from their defaults. The
following arguments report the current settings of the terminal:
all Reports all normally used non-termio option settings.
everything Reports all non-termio option settings.
Non-Termio Options
The option strings for terminals that are not using the termio line
discipline are selected from the following set:
even Allows even parity input.
-even Disallows even parity input.
odd Allows odd parity input.
-odd Disallows odd parity input.
raw Specifies raw mode input with no input processing (for
example, erase, kill, interrupt); parity bit passed
back.
-raw Negates raw mode.
cooked Negates raw mode.
cbreak Makes each character available to as it is received; all
processing other than erase and kill processing is per‐
formed.
-cbreak Makes characters available to read only when new line is
received.
-nl Allows carriage return for new-line, and outputs CR-LF
for carriage return or new-line.
nl Accepts only new-line to end lines.
echo Echoes back every character typed.
-echo Does not echo characters.
lcase Maps upper case to lower case.
-lcase Does not map case.
tandem Enables flow control. The system sends out the stop
character when its internal queue is in danger of over‐
flowing on input; it sends the start character when it
is ready to accept further input.
-tandem Disables flow control.
-tabs Replaces tabs with spaces when printing.
tabs Preserves tabs. This option may cause unpredictable
behavior if unprintable characters, such as escape
sequences, are sent to the terminal.
ek Sets erase and kill characters to the pound sign (#) and
at sign (@) respectively.
termiod Sets line discipline to termio line discipline. Note
that once the line discipline has been changed to
TERMIODISC, the termio options to should be used.
disc Reports the current line discipline.
old Sets line discipline to the old line discipline
(OTTDISC).
The following commands take a character argument c. You may specify u
or undef instead of c to leave the value undefined. The two character
sequence of is also interpreted as a control character, with represent‐
ing delete.
erase c Sets the erase character to c. The default is the pound
sign (#), but it is often reset to <CTRL/H>.
kill c Sets the kill character to c. The default is the at
sign (@), but it is often reset to <CTRL/U>.
intr c Sets the interrupt character to c. The default is DEL
or but it is often reset to <CTRL/C>.
quit c Sets the quit character to c. The default is <CTRL/\>.
start c Sets the start character to c. The default is <CTRL/Q>.
stop c Sets the stop character to c. The default is <CTRL/S>.
eof c Sets the end of file character to c. The default is
<CTRL/S>.
brk c Sets the break character to c. The default is unde‐
fined. This character causes a wakeup.
cr0 cr1 cr2 cr3
Selects style of delay for carriage return; see for more
information.
nl0 nl1 nl2 nl3
Selects style of delay for linefeed.
tab0 tab1 tab2 Selects style of delay for tab.
ff0 ff1 Selects style of delay for form feed.
bs0 bs1 Selects style of delay for backspace.
dec Sets all modes suitable for Digital Equipment Corpora‐
tion operating systems users. This command sets erase
to <CTRL/?>, kill to <CTRL/U>, and interrupt to
<CTRL/C>. It also sets the decctlq and newcrt options.
size Prints the display size. The format is (rows) (col‐
umns).
rows i Sets the number of rows in the display to i.
cols i Sets the number of columns in the display to i.
excl Sets line to exclusive use.
-excl Clears exclusive use status.
0 Hangs up phone line immediately.
50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 exta extb
Sets terminal baud rate to the number given, if possi‐
ble.
The following are unsupported terminal devices:
tty33 Sets all modes suitable for the Teletype Corporation
Model 33 terminal.
tty37 Sets all modes suitable for the Teletype Corporation
Model 37 terminal.
vt05 Sets all modes suitable for Digital Equipment Corpora‐
tion VT05 terminal.
tn300 Sets all modes suitable for a General Electric TermiNet
300.
ti700 Sets all modes suitable for Texas Instruments 700 series
terminal.
tek Sets all modes suitable for Tektronix 4014 terminal.
A teletype driver that supports the job control processing of and has
more functionality than the basic driver is fully described in The fol‐
lowing options apply only to it:
new Uses new driver (switching flushes typeahead). Sets
line discipline to NTTYDISC.
crt Sets options for a CRT (crtbs, ctlecho and, if greater
than or equal to 1200 baud, it sets crterase and
crtkill.)
crtbs Echoes backspaces on erase characters.
prterase Echoes characters that have been erased.
crterase Wipes out erased characters with the following combina‐
tion of keystrokes: backspace-space-backspace.
-crterase Leaves characters visible that have been erased. Invoke
this option by using the backstroke key alone.
crtkill Wipes out input. Similar to crterase in how it works.
-crtkill Echoes the line kill character and a new line on line
kill.
ctlecho Echoes control characters as a circumflex followed by
the character. For example, echoes as ^X. Type two
backspaces following the EOT character (<CTRL/D>).
-ctlecho Echoes control characters as themselves; in cooked mode
EOT (<CTRL/D>) is not echoed.
decctlq Enables a start character (normally <CTRL/Q>) to restart
output when it has been suspended.
-decctlq Enables any character that you type to restart output
when it has been suspended. The start character
restarts output without providing any input. This is
the default.
noflsh Suppresses flushing of input and output queues upon
receipt of an interrupt signal.
-noflsh Flushes input and output queues upon receipt of inter‐
rupt signal.
tostop Stops background jobs if they attempt terminal output.
-tostop Allows output from background jobs to the terminal.
tilde Converts the tilde ( ) to a backslash (\) on output.
-tilde Suppresses conversion of the tilde ( ) to a backslash
(\).
flusho Discards output usually because the user hit a (internal
state bit).
-flusho Output is not discarded.
pendin Resubmits input that is pending after a switch from
cbreak to cooked. Activated when a read becomes pending
or more input arrives (internal state bit).
-pendin Specifies that input is not pending.
litout Sends output characters without any processing.
-litout Does normal output processing, such as inserting delays.
autoflow Causes the terminal multiplexer to automatically respond
to start and stop characters. This functionality is
only provided if the stop character is and the start
character is <CTRL/Q>.
-autoflow Uses software controlled flow control.
nohang Does not send a hangup signal if the carrier drops.
Note that the nohang option should be used carefully.
For example, suppose that you have the option in your
.login file and are logged in over a modem. If the car‐
rier drops, the next call in on this line gets your
active shell.
-nohang Sends a hangup signal to control process group when car‐
rier drops.
pass8 Allows full eight bit ascii characters in input and out‐
put.
-pass8 Strips characters to seven bits, thus disallowing the
use of eight bit ascii characters.
The following special characters are applicable only when the line dis‐
cipline is set to NTTYDISC. They are not normally changed. The new
option sets the line discipline to NTTYDISC.
susp c Sets the suspend process character to c. The default is
<CTRL/Z>.
dsusp c Sets the delayed suspend process character to c. The
default is <CTRL/Y>.
rprnt c Sets the reprint line character to c. The default is
<CTRL/R>.
flush c Sets the flush output character to c. The default is
<CTRL/O>.
werase c Sets the word erase character to c. The default is
<CTRL/W>.
lnext c Sets the literal next character to c. The default is
<CTRL/V>.
quote c Sets the quote character (for erase and kill) to c. The
default is <CTRL/\>.
Termio Operation
This section describes the arguments and options that are used when the
terminal line is set to the termio line discipline (TERMIODISC). The
termio line discipline is intended for programs that use either IEEE
P1003 termios, or System Five style termio. Unless noted otherwise,
all options in this section are applicable to both IEEE P1003 termios
or System Five termio.
With no arguments, stty reports the speed of the terminal and the set‐
tings of certain options.
-a Reports option settings relevant to System Five termios.
-p Reports option settings relevant to IEEE POSIX termios.
For more information about the modes listed in the first five groups
below refer to and
Termio Options
For terminals that are using the termio line discipline, select option
strings from the following set:
Control Modes
parenb (-parenb) Enables (disables) parity generation and detection.
parodd (-parodd) Selects odd (even) parity.
cs5 cs6 cs7 cs8 Select character size.
0 Hangs up phone line immediately.
50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 exta extb
Sets terminal baud rate to the number given, if pos‐
sible. (All speeds are not supported by all hardware
interfaces.)
hupcl (-hupcl) Sends (does not send) hangup signal on last close of
terminal line.
cstopb (-cstopb) Uses two (one) stop bits per character.
cread (-cread) Enables (disables) the receiver.
clocal (-clocal) Assumes a line without (with) modem control.
loblk (-loblk) Blocks (does not block) output from a non-current
layer. (System Five termio only)
autoflow (-autoflow)
Line operates with (without) hardware monitored flow
control. (POSIX only)
Input Modes
ignbrk (-ignbrk) Ignores (does not ignore) break on input.
brkint (-brkint) Signals (does not signal) INTR on break.
ignpar (-ignpar) Ignores (does not ignore) parity errors.
parmrk (-parmrk) Marks (does not mark) parity errors.
inpck (-inpck) Enables (disables) input parity checking.
istrip (-istrip) Strips (does not strip) input characters to seven
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) upper-case alphabetics to lower
case 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) lower-case alphabetics to upper case on out‐
put.
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 output (outputs) CRs at column zero.
onlret (-onlret)
Performs (does not perform) the CR function on the terminal NL.
ofill (-ofill)
Uses fill characters (uses timing) for delays.
ofdel (-ofdel)
Specifies fill characters as DELs (NULs).
cr0 cr1 cr2 cr3
Selects style of delay for carriage returns.
nl0 nl1
Selects style of delay for line-feeds.
tab0 tab1 tab2 tab3
Selects style of delay for horizontal tabs.
bs0 bs1
Selects style of delay for backspaces.
ff0 ff1
Selects style of delay for form-feeds.
vt0 vt1
Selects style of delay for vertical tabs.
Local Modes
isig (-isig) Enables (disables) the checking of characters against
the special control characters INTR and QUIT.
icanon (-icanon) Enables (disables) canonical input (ERASE and KILL
processing).
xcase (-xcase) Presents canonical (unprocessed) upper/lower-case.
echo (-echo) Echoes (does not echo) every character typed.
echoe (-echoe) Echoes (does not echo) ERASE character as a
backspace-space-backspace string. Note that this
mode erases the ERASEed character on many CRT termi‐
nals; however, it does not keep track of column posi‐
tion and, as a result, may be confusing on escaped
characters, tabs, and backspaces.
echok (-echok) Echoes (does not echo) NL after KILL character.
echonl (-echonl) Echoes (does not echo) NL.
noflsh (-noflsh) Disables (enables) flush after INTR or QUIT.
ctlech (-ctlech) Echoes (echo control characters unchanged) control
characters as ^x and delete as ^?. (POSIX only)
prtera (-prtera) Echoes (does not echo) erased characters enclosed
within back and forward slashes (\ /) for printing
terminals. (POSIX only)
crtera (-crtera) Wipes out (simply backspace) erased characters with
backspace-space-backspace. (POSIX only)
crtkil (-crtkil) Wipes out line (kill character and newline) with
backspace-space-backspace. (POSIX ONLY)
Control Assignments
control-character c
Sets control-character to c, where control-character
is erase, kill, intr, quit, eof, eol, min, or time
(min and time are used with -icanon.
The following control characters are applicable to POSIX mode only:
susp, dsusp, rprnt, flush, werase, lnext, quote.
If c is preceded by a circumflex (^), then the value used is the corre‐
sponding CTRL character (for example, ^d is a CTRL-d ); ^? is inter‐
preted as DEL and ^- is interpreted as undefined.
The new option sets the line discipline to NTTYDISC. Note that this
changes the line discipline to be a non-termio line discipline. Once
this has been done the options described in the non-termio section
should be used.
Combination Modes
evenp or parity Enables parenb and cs7.
oddp Enables parenb, cs7, and parodd.
-parity, -evenp, or -oddp
Disables parenb, and set cs8.
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) Sets (unsets) xcase, iuclc, and olcuc.
tabs (-tabs or tab3)
Preserves (expands to spaces) tabs when printing.
ek Resets ERASE and KILL characters back to normal # and
@.
sane Resets all modes to some reasonable values.
See Alsoioctl(2), tabs(1), tset(1), tty(4), termio(4), termios(4)stty(1)