Table of Contents

Name

stty - set the options for a terminal

Synopsis

stty [ -a| -g]

stty operands

Description

The stty utility shall set or report on terminal I/O characteristics for the device that is its standard input. Without options or operands specified, it shall report the settings of certain characteristics, usually those that differ from implementation-defined defaults. Otherwise, it shall modify the terminal state according to the specified operands. Detailed information about the modes listed in the first five groups below are described in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface. Operands in the Combination Modes group (see Combination Modes ) are implemented using operands in the previous groups. Some combinations of operands are mutually-exclusive on some terminal types; the results of using such combinations are unspecified.

Typical implementations of this utility require a communications line configured to use the termios interface defined in the System Interfaces volume of IEEE Std 1003.1-2001. On systems where none of these lines are available, and on lines not currently configured to support the termios interface, some of the operands need not affect terminal characteristics.

Options

The stty utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.

The following options shall be supported:

-a
Write to standard output all the current settings for the terminal.
-g
Write to standard output all the current settings in an unspecified form that can be used as arguments to another invocation of the stty utility on the same system. The form used shall not contain any characters that would require quoting to avoid word expansion by the shell; see Word Expansions .

Operands

The following operands shall be supported to set the terminal characteristics.

Control Modes

parenb (-parenb)
Enable (disable) parity generation and detection. This shall have the effect of setting (not setting) PARENB in the termios c_cflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
parodd (-parodd)

Select odd (even) parity. This shall have the effect of setting (not setting) PARODD in the termios c_cflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.

cs5 cs6 cs7 cs8
Select character size, if possible. This shall have the effect of setting CS5, CS6, CS7, and CS8, respectively, in the termios c_cflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
number
Set terminal baud rate to the number given, if possible. If the baud rate is set to zero, the modem control lines shall no longer be asserted. This shall have the effect of setting the input and output termios baud rate values as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ispeed number
Set terminal input baud rate to the number given, if possible. If the input baud rate is set to zero, the input baud rate shall be specified by the value of the output baud rate. This shall have the effect of setting the input termios baud rate values as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ospeed number
Set terminal output baud rate to the number given, if possible. If the output baud rate is set to zero, the modem control lines shall no longer be asserted. This shall have the effect of setting the output termios baud rate values as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
hupcl (-hupcl)
Stop asserting modem control lines (do not stop asserting modem control lines) on last close. This shall have the effect of setting (not setting) HUPCL in the termios c_cflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
hup (-hup)
Equivalent to hupcl( -hupcl).
cstopb (-cstopb)
Use two (one) stop bits per character. This shall have the effect of setting (not setting) CSTOPB in the termios c_cflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
cread (-cread)
Enable (disable) the receiver. This shall have the effect of setting (not setting) CREAD in the termios c_cflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
clocal (-clocal)
Assume a line without (with) modem control. This shall have the effect of setting (not setting) CLOCAL in the termios c_cflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.

It is unspecified whether stty shall report an error if an attempt to set a Control Mode fails.

Input Modes

ignbrk (-ignbrk)
Ignore (do not ignore) break on input. This shall have the effect of setting (not setting) IGNBRK in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
brkint (-brkint)
Signal (do not signal) INTR on break. This shall have the effect of setting (not setting) BRKINT in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ignpar (-ignpar)
Ignore (do not ignore) bytes with parity errors. This shall have the effect of setting (not setting) IGNPAR in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
parmrk (-parmrk)

Mark (do not mark) parity errors. This shall have the effect of setting (not setting) PARMRK in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.

inpck (-inpck)
Enable (disable) input parity checking. This shall have the effect of setting (not setting) INPCK in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
istrip (-istrip)
Strip (do not strip) input characters to seven bits. This shall have the effect of setting (not setting) ISTRIP in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
inlcr (-inlcr)
Map (do not map) NL to CR on input. This shall have the effect of setting (not setting) INLCR in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
igncr (-igncr)
Ignore (do not ignore) CR on input. This shall have the effect of setting (not setting) IGNCR in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
icrnl (-icrnl)
Map (do not map) CR to NL on input. This shall have the effect of setting (not setting) ICRNL in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ixon (-ixon)
Enable (disable) START/STOP output control. Output from the system is stopped when the system receives STOP and started when the system receives START. This shall have the effect of setting (not setting) IXON in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ixany (-ixany)
Allow any character to restart output. This shall have the effect of setting (not setting) IXANY in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ixoff (-ixoff)
Request that the system send (not send) STOP characters when the input queue is nearly full and START characters to resume data transmission. This shall have the effect of setting (not setting) IXOFF in the termios c_iflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.

Output Modes

opost (-opost)
Post-process output (do not post-process output; ignore all other output modes). This shall have the effect of setting (not setting) OPOST in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ocrnl (-ocrnl)
Map (do not map) CR to NL on output This shall have the effect of setting (not setting) OCRNL in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
onocr (-onocr)
Do not (do) output CR at column zero. This shall have the effect of setting (not setting) ONOCR in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
onlret (-onlret)
The terminal newline key performs (does not perform) the CR function. This shall have the effect of setting (not setting) ONLRET in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ofill (-ofill)
Use fill characters (use timing) for delays. This shall have the effect of setting (not setting) OFILL in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ofdel (-ofdel)
Fill characters are DELs (NULs). This shall have the effect of setting (not setting) OFDEL in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
cr0 cr1 cr2 cr3
Select the style of delay for CRs. This shall have the effect of setting CRDLY to CR0, CR1, CR2, or CR3, respectively, in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
nl0 nl1
Select the style of delay for NL. This shall have the effect of setting NLDLY to NL0 or NL1, respectively, in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
tab0 tab1 tab2 tab3

Select the style of delay for horizontal tabs. This shall have the effect of setting TABDLY to TAB0, TAB1, TAB2, or TAB3, respectively, in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface. Note that TAB3 has the effect of expanding <tab>s to <space>s.

tabs (-tabs)
Synonym for tab0 ( tab3).
bs0 bs1
Select the style of delay for backspaces. This shall have the effect of setting BSDLY to BS0 or BS1, respectively, in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
ff0 ff1
Select the style of delay for form-feeds. This shall have the effect of setting FFDLY to FF0 or FF1, respectively, in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
vt0 vt1
Select the style of delay for vertical-tabs. This shall have the effect of setting VTDLY to VT0 or VT1, respectively, in the termios c_oflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.

Local Modes

isig (-isig)
Enable (disable) the checking of characters against the special control characters INTR, QUIT, and SUSP. This shall have the effect of setting (not setting) ISIG in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
icanon (-icanon)
Enable (disable) canonical input (ERASE and KILL processing). This shall have the effect of setting (not setting) ICANON in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
iexten (-iexten)
Enable (disable) any implementation-defined special control characters not currently controlled by icanon, isig, ixon, or ixoff. This shall have the effect of setting (not setting) IEXTEN in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
echo (-echo)
Echo back (do not echo back) every character typed. This shall have the effect of setting (not setting) ECHO in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
echoe (-echoe)
The ERASE character visually erases (does not erase) the last character in the current line from the display, if possible. This shall have the effect of setting (not setting) ECHOE in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
echok (-echok)
Echo (do not echo) NL after KILL character. This shall have the effect of setting (not setting) ECHOK in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
echonl (-echonl)
Echo (do not echo) NL, even if echo is disabled. This shall have the effect of setting (not setting) ECHONL in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
noflsh (-noflsh)
Disable (enable) flush after INTR, QUIT, SUSP. This shall have the effect of setting (not setting) NOFLSH in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.
tostop (-tostop)
Send SIGTTOU for background output. This shall have the effect of setting (not setting) TOSTOP in the termios c_lflag field, as defined in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface.

Special Control Character Assignments

<control>-character string

Set <control>-character to string. If <control>-character is one of the character sequences in the first column of the following table, the corresponding Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal Interface control character from the second column shall be recognized. This has the effect of setting the corresponding element of the termios c_cc array (see the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 13, Headers, <termios.h>).
Table: Control Character Names in stty

If string is a single character, the control character shall
be set to that character. If string is the
two-character sequence "^-" or the string undef, the control
character shall be set to _POSIX_VDISABLE , if it is
in effect for the device; if _POSIX_VDISABLE is not in effect for
the device, it shall be treated as an error. In the POSIX locale,
if string is a two-character sequence beginning with circumflex
( ’^’ ), and the second character is one of those
listed in the "^c" column of the following table, the control
character shall be set to the corresponding character value

min numberSet the value of MIN to number. MIN is used in non-canonicalmode input processing ( icanon).time numberSet the value of TIME to number. TIME is used in non-canonicalmode input processing ( icanon).Combination Modes


saved settingsSet the current terminal characteristics to the saved settings producedby the -g option.evenp or parityEnable parenb and cs7; disable parodd.oddpStdin

Input Files

Environment Variables

Asynchronous Events

Stdout




Stderr

Output Files

Extended Description

Exit Status

Consequences of Errors

Application Usage


Examples

Rationale

Future Directions

See Also

Copyright


Table of Contents