stty(1) stty(1)
NAME
stty - check and change terminal arguments (set terminal type)
SYNOPSIS
stty [{-a | -g}]
stty [argument ...]
DESCRIPTION
stty can be used to check or change terminal arguments.
Note:
Depending on the implementation, some stty arguments such as
parext, iexten and stflush are accepted but not interpreted by
the driver, so these arguments will not have any effect.
OPTIONS
No option and no argument specified:
stty reports some of the argument settings for the device that is
its current standard input.
-a Reports all currently valid terminal argument settings.
-g Reports current settings in a form that can be used as input to
another stty command.
Arguments for setting input/output characteristics
The following section describes the various arguments available when
setting I/O characteristics for the terminal that is stty's current
standard input. The I/O arguments are listed in five main groups:
- Data transfer control arguments
- Input control arguments
- Output control arguments
- Local features
- Control assignments.
An additional group constitutes combinations of arguments from these
five groups.
Explanations related to parenthesized arguments are also indicated
within parentheses.
Note that even though many combinations of arguments make no sense,
stty does no sanity checking.
Page 1 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
Data transfer control arguments
The following table provides an overview of the various arguments that
can be used to control data transfer:
______________________________________________________________________
| Argument | Brief description |
|________________|____________________________________________________|
| parenb | Enable parity generation and detection |
|________________|____________________________________________________|
| parext | Extended parity generation and detection |
|________________|____________________________________________________|
| parodd | Odd parity |
|________________|____________________________________________________|
| csize | Define character size: cs5, cs6, cs7 or cs8 |
|________________|____________________________________________________|
| 0 | Hang up lines immediately |
|________________|____________________________________________________|
| number | Set input baud rate to number |
|________________|____________________________________________________|
| ispeed number | Set terminal input baud rate to number |
|________________|____________________________________________________|
| ospeed number | Set terminal output baud rate to number |
|________________|____________________________________________________|
| hupcl | Hang up connection on last close(2) |
|________________|____________________________________________________|
| hup | Same as hupcl |
|________________|____________________________________________________|
| cstopb | Use two stop bits per character |
|________________|____________________________________________________|
| cread | Enable receiver |
|________________|____________________________________________________|
| clocal | Modem control signals not supported |
|________________|____________________________________________________|
| loblkl | Block output from a non-current layer |
|________________|____________________________________________________|
parenb (-parenb)
Enable (disable) parity generation and detection.
parext (-parext)
Enable (disable) extended parity generation and detection for
mark and space parity.
parodd (-parodd)
Select odd (even) parity, or mark (space) parity if parext is
enabled. These arguments are only effective in combination with
the parenb and parext arguments.
csize
Define character size. csize can have any of the following values:
cs5, cs6, cs7, or cs8. The number specifies how many bits are used
to represent a character during I/O (excluding the parity bit).
Page 2 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
0 Hang up lines immediately. This applies to all terminal lines -
not just modem lines. A SIGHUP signal is sent to all processes
attached to the terminal.
number
Set baud rate to the number given, if possible. Note that not all
baud rates are supported by all hardware interfaces [see ter-
mio(7)].
ispeed number
Set terminal input baud rate to the number given. Note that not
all devices support different input and output baud rates. If the
input baud rate is set to zero, the input baud rate will be set
to the value of the output baud rate.
Possible values for number are: 50, 75, 110, 134, 150, 200, 300,
600, 1200, 1800, 2400, 4800, 9600, 19200, 38400.
ospeed number
Set terminal output baud rate to the number given. Note that not
all devices support different input and output baud rates. If the
output baud rate is set to zero, the line will be hung up immedi-
ately.
Possible values for number are: 50, 75, 110, 134, 150, 200, 300,
600, 1200, 1800, 2400, 4800, 9600, 19200, 38400.
hupcl (-hupcl)
Hang up (do not hang up) modem connection after last call to
close(2).
hup (-hup)
Same as hupcl (-hupcl).
cstopb (-cstopb)
Use two (one) stop-bit(s) per character.
cread (-cread)
Enable (disable) the receiver. If cread is not set, no characters
can be received.
clocal (-clocal)
Assume a local direct connection without (with) modem control.
Modem control signals are therefore not supported (or supported).
loblk (-loblk)
Block (do not block) output from a non-current layer.
Page 3 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
Input control arguments
The following arguments can be used to control the input of data:
______________________________________________________________________
| Argument | Brief description |
|________________|____________________________________________________|
| ignbrk | Ignore break on input |
|________________|____________________________________________________|
| brkint | SIGINT on break |
|________________|____________________________________________________|
| ignpar | Ignore parity errors |
|________________|____________________________________________________|
| parmrk | Mark characters with parity errors |
|________________|____________________________________________________|
| inpck | Enable input parity checking |
|________________|____________________________________________________|
| istrip | Mask input characters to 7 bits |
|________________|____________________________________________________|
| inlcr | Map newline to carriage return on input |
|________________|____________________________________________________|
| igncr | Ignore carriage return on input |
|________________|____________________________________________________|
| icrnl | Map carriage return to newline on input |
|________________|____________________________________________________|
| iuclc | Map uppercase letters to lowercase on input |
|________________|____________________________________________________|
| ixon | Enable START/STOP output control |
|________________|____________________________________________________|
| ixany | Allow any character to restart output |
|________________|____________________________________________________|
| ixoff | Do not send STOP character when input queue is |
| | nearly full |
|________________|____________________________________________________|
| imaxbel | Echo ASCII BEL character when input line is too |
| | long |
|________________|____________________________________________________|
ignbrk (-ignbrk)
Ignore (do not ignore) break on input.
brkint (-brkint)
Send (do not send) SIGINT on break.
ignpar (-ignpar)
Ignore (do not ignore) parity errors.
parmrk (-parmrk)
Mark (do not mark) characters with parity errors.
inpck (-inpck)
Enable (disable) parity checking on input.
Page 4 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
istrip (-istrip)
Mask (do not mask) input characters to 7 bits.
inlcr (-inlcr)
Map (do not map) newline character to carriage return on input.
igncr (-igncr)
Ignore (do not ignore) carriage returns on input.
icrnl (-icrnl)
Map (do not map) carriage return to newline character on input.
iuclc (-iuclc)
Map (do not map) uppercase letters to lowercase on input.
ixon (-ixon)
Enable (disable) START/STOP output control. Output is stopped by
sending an ASCII DC3 and started by sending an ASCII DC1 [see
ascii(5)].
ixany (-ixany)
Allow any character (only the ASCII character DC1) to restart
output.
ixoff (-ixoff)
Request that the system send (not send) START/STOP characters
when the input queue is nearly empty/full.
imaxbel (-imaxbel)
Echo (do not echo) the ASCII BEL character when the input line is
too long.
Page 5 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
Output control arguments
The following arguments can be used to control the output of data:
______________________________________________________________________
| Argument | Brief description |
|________________|____________________________________________________|
| opost | Post-process output in accordance with subsequent |
| | arguments |
|________________|____________________________________________________|
| oluc | Map lowercase letters to uppercase on output |
|________________|____________________________________________________|
| onlcr | Map newline to carriage return on output |
|________________|____________________________________________________|
| ocrnl | Map carriage return to newline on output |
|________________|____________________________________________________|
| onocr | Do not output carriage returns in column 0 |
|________________|____________________________________________________|
| onlret | Newline also performs the carriage return function|
|________________|____________________________________________________|
| ofill | Use fill characters for data transmission delays |
|________________|____________________________________________________|
| ofdel | Use abort character DEL 0x7 as fill character |
|________________|____________________________________________________|
| cr0,1,2,3 | Select extent of delay for carriage returns on |
| | output |
|________________|____________________________________________________|
| nl0 nl1 | Select extent of delay for newline characters on |
| | output |
|________________|____________________________________________________|
| tab0,1,2,3 | Select extent of delay for horizontal tabs on out-|
| | put |
|________________|____________________________________________________|
| bs0,1 | Select extent of delay for backspaces on output |
|________________|____________________________________________________|
| ff0,1 | Select extent of delay for form feeds on output |
|________________|____________________________________________________|
| vt0,1 | Select extent of delay for vertical tabs on output|
|________________|____________________________________________________|
opost (-opost)
Post-process output in accordance with the other specified argu-
ments (do not post-process output: ignore all other output con-
trol arguments).
olcuc (-olcuc)
Map (do not map) lowercase letters to uppercase on output.
onlcr (-onlcr)
Map (do not map) newline character to carriage return on output.
ocrnl (-ocrnl)
Map (do not map) carriage return to newline character on output.
Page 6 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
onocr (-onocr)
Do not (do) output carriage return in column 0.
onlret (-onlret)
A newline character also performs (does not perform) the carriage
return function on output.
ofill (-ofill)
Use fill characters (use timing) for data transmission delays.
ofdel (-ofdel)
Use abort character DEL 0x7f (null character NUL 0x0) as fill
character.
cr0 cr1 cr2 cr3
Select extent of delay for carriage returns on output [see
termio(7)].
nl0 nl1
Select extent of delay for newline characters on output [see
termio(7)].
tab0 tab1 tab2 tab3
Select extent of delay for horizontal tabs on output [see
termio(7)].
bs0 bs1
Select extent of delay for backspaces on output [see termio(7)].
ff0 ff1
Select extent of delay for form feeds on output [see termio(7)].
vt0 vt1
Select extent of delay for vertical tabs on output [see
termio(7)].
Page 7 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
Local features
______________________________________________________________________
| Argument | Brief description |
|________________|____________________________________________________|
| isig | Enable checking of input characters against con- |
| | trol characters intr, quit, and swtch |
|________________|____________________________________________________|
| icanon | Enable canonical input |
|________________|____________________________________________________|
| xcase | Enable canonical upper/lowercase presentation |
|________________|____________________________________________________|
| echo | Echo back every character typed |
|________________|____________________________________________________|
| echoe | Echo erase character as backspace-space-backspace |
| | string |
|________________|____________________________________________________|
| echok | Output an additional newline after the kill char- |
| | acter |
|________________|____________________________________________________|
| lfck | Same as echok |
|________________|____________________________________________________|
| echonl | Output newline characters |
|________________|____________________________________________________|
| noflsh | Disable flushing of the I/O queue |
|________________|____________________________________________________|
| stwrap | Disable truncation of lines on a synchronous line |
|________________|____________________________________________________|
| tostop | Send SIGTTOU when background processes write to |
| | the terminal |
|________________|____________________________________________________|
| echoctl | Output control characters in the form: ^char |
|________________|____________________________________________________|
| echoprt | Output erase character when a character is |
| | "erased" |
|________________|____________________________________________________|
| echoke | Output a backspace-space-backspace sequence to |
| | erase the entire line to be killed |
|________________|____________________________________________________|
| flusho | Flush output queue |
|________________|____________________________________________________|
| pendin | Retype pending input |
|________________|____________________________________________________|
| iexten | Enable extended functions for input data |
|________________|____________________________________________________|
| stflush | Flush output queue after every write |
|________________|____________________________________________________|
| stappl | Use application mode on a synchronous line |
|________________|____________________________________________________|
Page 8 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
isig (-isig)
Enable (disable) the checking of each input character against the
special control characters intr, quit, and swtch (see Control
Assignments). If a match is found, the function associated with
the control character is executed (not executed).
icanon (-icanon)
Enable (disable) canonical input, i.e. the special functions of
the characters erase and kill are (are not) performed on input
[see termio(7)].
xcase (-xcase)
Enable (disable) canonical uppercase/lowercase presentation.
echo (-echo)
Echo back (do not echo back) every character typed.
echoe (-echoe)
Echo (do not echo) erase characters as a backspace-space-
backspace string.
Caution: Setting the echoe argument will erase the character
overwritten with erase on many terminals; however, since
this mode does not keep track of the column position,
problems may arise with escaped characters, tabs, and
backspaces.
echok (-echok)
Output (do not output) an additional newline after a kill charac-
ter.
lfkc (-lfkc)
The same as echok (-echok); obsolete.
echonl (-echonl)
Output (do not output) newline characters.
noflsh (-noflsh)
Disable (enable) the flushing of input and output queues on
detection of an intr, quit, or swtch signal.
stwrap (-stwrap)
Disable (enable) truncation of lines longer than 79 characters on
a synchronous line.
tostop (-tostop)
Send (do not send) SIGTTOU when background processes write to the
terminal.
Page 9 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
echoctl (-echoctl)
Output (do not output) control characters as ^char (delete as
^?).
echoprt (-echoprt)
Output (do not output) erase character when a character is
"erased".
echoke (-echoke)
Output a backspace-space-backspace sequence to erase entire line
to be killed.
flusho (-flusho)
Flush (do not flush) the output queue.
pendin (-pendin)
Retype (do not retype) pending input at next read or input char-
acter.
iexten (-iexten)
Enable (disable) extended functions for input data. These include
the special characters werase, reprint, discard and lnext, and
the local features tostop, echoctl, echoprt, echoke, flusho and
pendin.
stflush (-stflush)
Flush (do not flush) output queue on a synchronous line after
every write.
stappl (-stappl)
Use application mode (use line mode) on a synchronous line.
Control assignments
control-character c
Set control-character to c, where control-character can be:
ctab, discard, dsusp, eof, eol, eol2, erase,intr, kill, lnext,
quit, reprint, start, stop, susp, swtch, werase, min or time (min
and time are used with -icanon; ctab is used with -stappl). If c
is preceded by the ^ character, then the value used is the corre-
sponding CTRL character (e.g. ^D corresponds to <CTRL-D>). ^? is
interpreted as <DEL>, and ^- is interpreted as undefined.
min number
time number
Set the value of min or time to number. min and time are used
with -icanon [see termio(7)].
line i
Set line discipline to i (0 < i < 127).
Page 10 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
Combination modes
The following combination modes may be used to control the terminal:
______________________________________________________________________
| Argument | Brief description |
|________________|____________________________________________________|
| evenp | Enable parenb and cs7 |
|________________|____________________________________________________|
| parity | Same as evenp |
|________________|____________________________________________________|
| oddp | Enable parenb, cs7 and parodd |
|________________|____________________________________________________|
| spacep | Enable parenb, cs7 and parext |
|________________|____________________________________________________|
| markp | Enable parenb, cs7, parodd and parext |
|________________|____________________________________________________|
| -evenp | Disable parenb, and enable cs8 |
|________________|____________________________________________________|
| -parity | Same as parity |
|________________|____________________________________________________|
| -oddp | Disable parenb and parodd, and enable cs8 |
|________________|____________________________________________________|
| -spacep | Disable parenb and parext, and enable cs8 |
|________________|____________________________________________________|
| -markp | Disable parenb, parodd, and parext, and enable cs8|
|________________|____________________________________________________|
| raw | Enable raw mode |
|________________|____________________________________________________|
| nl | Disable icrnl, ocrnl, inlcr, igncr, ocrnl, and |
| | onlret |
|________________|____________________________________________________|
| lcase | Enable xcase, iuclc, and oluc |
|________________|____________________________________________________|
| LCASE | Same as lcase |
|________________|____________________________________________________|
| tabs | Preserve tabs when printing |
|________________|____________________________________________________|
| ek | Reset erase and kill to original values |
|________________|____________________________________________________|
| sane | Reset all terminal arguments to reasonable values |
|________________|____________________________________________________|
| term | Set all values for a terminal type term |
|________________|____________________________________________________|
| asysnc | Set normal asynchronous communication |
|________________|____________________________________________________|
evenp or parity
Enable parenb and cs7.
oddp Enable parenb, cs7, and parodd.
Page 11 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
spacep
Enable parenb, cs7, and parext.
markp
Enable parenb, cs7, parodd, and parext.
-parity or -evenp
Disable parenb, and enable cs8.
-oddp
Disable parenb and parodd, and enable cs8.
-spacep
Disable parenb and parext, and enable cs8.
-markp
Disable parenb, parodd, and parext, and enable cs8.
raw (-raw or cooked)
Enable (disable) raw input and output; raw mode is equivalent to:
cs8, with no erase, kill, intr, quit, swtch, eof, or output
post-processing, and no parity bit.
nl (-nl)
Disable (enable) icrnl, and onlcr. In addition, -nl disables
inlcr, igncr, ocrnl, and onlret.
lcase (-lcase)
Enable (disable) xcase, iuclc, and olcuc.
LCASE (-LCASE)
Same as lcase (-lcase).
tabs (-tabs or tab8)
Preserve tabs (expand to spaces) when printing.
ek Reset control characters erase and kill back to system-specific
default values.
sane Reset all terminal arguments to some reasonable values.
term Set all arguments suitable for the terminal type term, where term
is one of the following: tty33, tty37, vt05, tn300, ti700, or
tek.
async
Set normal asynchronous communication where clock settings are
xcibrg, rcibrg, tsetcoff and rsetcoff [see also termiox(7)].
Page 12 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
Example 1
Check current settings:
$ stty -a
speed 38400 baud;
intr = DEL; quit = ^|; erase = ^h;
kill = @; eof = ^d; eol <undef>; eol2 = <undef>; swtch <undef>;
start = ^q; stop = ^s; susp = ^z; dsusp = <undef>;
rprnt = ^r; flush = ^o; werase = ^w; lnext = ^v;
-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk parext
-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
ixon ixany -ixoff -imaxbel
isig icanon -xcase echo echoe echok -echonl -noflsh
-tostop -echoctl echoprt -echoke -defecho -flusho -pendin -iexten
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel ff1
Example 2
If you have inadvertently performed an action that causes inputs not
to be shown on the screen, you can restore the screen display by
entering the following command:
$ stty echo
The input of the above command will, however, not be displayed.
Example 3
Reset all terminal settings to reasonable values:
$ stty sane
Example 4
The terminal settings can also be reset with the aid of the -g argu-
ment:
$ STATUS=`stty -g`
Page 13 Reliant UNIX 5.44 Printed 11/98
stty(1) stty(1)
The above command defines a variable with the current settings of the
terminal (which may differ from those of stty sane). The existing ter-
minal settings can now be changed by resetting them with:
$ stty $STATUS
SEE ALSO
tabs(1), ioctl(2), ascii(5), termio(7), termiox(7).
Page 14 Reliant UNIX 5.44 Printed 11/98