stty
PURPOSE
Sets, resets, or reports work station operating parame-
ters.
SYNOPSIS
stty [ -a ] [ -g ] [ options ]
DESCRIPTION
The stty command sets certain work station I/O options
for the device that is the current standard input. If
you run it without any specifications, stty writes to
standard output information about any system adapters
installed and reports the settings of certain options.
If you list any work station specifications, stty sets or
resets the specified work station options.
You can find detailed information about the modes listed
in the first six of the following groups in the dis-
cussion of the termio special facility in AIX Operating
System Technical Reference. The last group contains
options produced by combining options in the first six
groups.
Note: The stty command does not make compatibility
checks on any parameter combinations.
FLAGS
-a Writes the current state of all option settings to
standard output.
-g Writes option settings to standard output in a form
usable by another stty command.
SPECIFICATIONS
Control Modes
The following options apply only when your work station
connects to the system through an asynchronous line
adapter. See asy in AIX Operating System Technical Ref-
erence for detailed information about this group.
parenb (-parenb) Enables (disables) parity generation
and detection.
parodd (-parodd) Selects odd (even) parity.
cs5 cs6 cs7 cs8 Selects character size. See termio in
AIX Operating System Technical Refer-
ence for additional information on
character size.
0 Hangs up phone line immediately.
50 75 110 134 150 300 600 1200 1800 2400 4800 9600 19200
19.2 38400 38.4 exta extb
Sets the work station speed to the
specified number of bits per second
(exta, 19200, and 19.2 are synonyms;
extb, 38400, and 38.4 are synonyms).
Regardless of the baud rate, the soft-
ware only works with terminals that
generate the ASCII character set.
hupcl (-hupcl)
hup (-hup) Hangs up (does not hang up) dial-up
connection on the last close.
cstopb (-cstopb) Selects 2 (1) stop bits per character.
The next two options apply to all work stations, regard-
less of the line adapter:
cread (-cread) Enables (disables) the receiver.
clocal (-clocal) Assumes a line without (with) modem
control.
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 charac-
ters 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 alpha-
betic characters to lowercase.
ixon (-ixon) Enables (disables) START/STOP output
control. Once START/STOP output
control has been enabled, you can pause
output to the work station by pressing
Ctrl-S and resume output by pressing
Ctrl-Q.
ixany (-ixany) Allows any character (only Ctrl-Q) to
restart output.
ixoff (-ixoff) Sends (does not send) START/STOP char-
acters when the input queue is nearly
empty/full.
Output Modes
opost (-opost) Processes output (does not process
output; that is, it ignores all other
output options).
olcuc (-olcuc) Maps (does not map) lowercase alpha-
betic characters to uppercase on
output.
onlcr (-onlcr) Maps (does not map) NL characters to
CR-NL characters.
ocrnl (-ocrnl) Maps (does not map) CR-NL characters to
NL characters.
onocr (-onocr) Does not (does) output CR characters at
column zero.
onlret (-onlret) On the terminal, NL performs (does not
perform) the CR function.
ofill (-ofill) Uses fill characters (uses timing) for
delays.
ofdel (-ofdel) Uses DEL (NUL) characters for fill
characters.
cr0 cr1 cr2 cr3 Selects style of delay for CR charac-
ters.
nl0 nl1 Selects style of delay for NL charac-
ters.
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
(canonical input allows input-line
editing with the ERASE and KILL charac-
ters).
xcase (-xcase) Echoes (does not echo) uppercase char-
acters on input, and displays uppercase
characters on output with a preceding \
(backslash).
echo (-echo) Echoes (does not echo) every character
typed.
echoe (-echoe) Echoes (does not echo) the ERASE char-
acter as the backspace-space-backspace
string.
Note: This mode does not keep track of
column position, so you may get unex-
pected results when erasing tabs,
escape sequences, and the like.
echok (-echok) Echoes (does not echo) a NL character
after a KILL character.
lfkc (-lfkc) Functions the same as echok. This is
an obsolete mode.
echonl (-echonl) Echoes (does not echo) the NL char-
acter.
noflsh (-noflsh) Does not clear (does clear) buffers
after INTR or QUIT.
Control Assignments
control-character c
Set control-character to c, where
control-character is erase, kill, intr,
quit, eof, eol, min, or time. (Use min
and time with -icanon.) If c is in the
form \^c (backslash circumflex c), then
its value is the corresponding CTRL
character. A \^? (backslash
circumflex question mark) is inter-
preted as DEL. A \^- (backslash
circumflex minus) is interpreted as
undefined.
enhedit (-enhedit)
Enters (leaves) the enhanced line
editing discipline (see the termio
special facility in AIX Operating
System Technical Reference).
ascedit (-ascedit)
Enters (leaves) the ASCII keyboard mode
for dosedit.
line i Sets the line discipline. i can be
either 0 or 1. "stty line 0" is the
same as "stty -enhedit". "stty line 1"
is the same as "stty enhedit".
Screen Length
page (-page) Pauses (does not pause) during output
after each screen displayed. Typing
any character during the pause causes
output to resume. Typing a space
during the pause causes output to con-
tinue uninterrupted until the next
command is entered.
length n Sets screen length to n lines, where n
is an integer from 1 through 255. An
automatic pause in output occurs after
n lines if page is enabled.
Combination Modes
evenp | parity Enables parenb and cs7.
oddp Enables parenb, cs7, and parodd.
-parity, -evenp, -oddp
Disables parenb and sets cs8.
raw (-raw | cooked) Enables (disables) raw input and
output (no ERASE, KILL, INTR, QUIT,
EOT, or output processing).
nl (-nl) Unsets (sets) icrnl and onlcr.
Specifying -nl sets icrnl and onlcr
and also unsets inlcr, igncr, ocrnl,
and onlret.
lcase (-lcase)
LCASE (-LCASE) Sets xcase, iuclc, and olcuc. (Used
for work stations with uppercase
characters only.)
tabs (-tabs | tab3) Preserve tabs (expand to spaces)
when printing.
ek Sets ERASE and KILL characters to
Ctrl-H and Ctrl-U, respectively.
sane Resets parameters to "reasonable"
values.
term Sets all parameters according to
work station type term, where term
is one of tty33, tty37, vt05, tn300,
ti700, or tek.
Terminal Mapping
imap mapname Loads /etc/nls/termmap/mapname.in as
the terminal input map.
omap mapname Loads /etc/nls/termmap/mapname.out as
the terminal output map.
EXAMPLES
1. To display a short listing of your work station con-
figuration:
stty
This lists settings that differ from the defaults.
2. To display a full listing of your work station con-
figuration:
stty -a
3. To enable a key sequence that stops listings from
scrolling off the screen:
stty ixon ixany
This sets ixon mode, which lets you stop runaway
listings by pressing Ctrl-S. The "ixany" parameter
allows you to resume the listing by pressing any key.
The normal work station configuration includes "ixon"
and "-ixany", which allows you to stop a listing with
Ctrl-S, but only Ctrl-Q will restart it.
4. To prevent all listings from scrolling off the
screen:
stty page length 24
This sets "page" mode with a page (screen) length of
"24" lines. When a listing is more than 24 lines
long, the system pauses after each page. It beeps,
reminding you to press any key (except the space bar)
to view the next page. Press the space bar to let
the rest of the listing scroll off the screen and get
to the end. Paging then resumes with the next
listing.
5. To reset the configuration after it has been messed
up:
Ctrl-J stty sane echo -tabs Ctrl-J
Sometimes the information displayed on the screen may
look strange, or the system won't respond when you
press the Enter key. This can happen when you use
stty with parameters that are incompatible or that do
things you don't understand. It can also happen when
a screen-oriented text editor ends abnormally and
doesn't have a chance to reset the work station con-
figuration.
Entering "stty sane" sets a reasonable configuration,
but it may differ slightly from your normal config-
uration. That is why this example also includes two
commonly used parameters, "echo" (erase characters as
you backspace over them) and "-tabs" (expand tab
characters to spaces on the display screen).
Press Ctrl-J before and after the command instead of
Enter. The system usually recognizes Ctrl-J when the
parameters that control the Enter key processing are
messed up.
6. To save and restore the work station's configuration:
OLDCONFIG=`stty -g` # save configuration
stty -echo # do not display password
echo "Enter password: \c"
read PASSWD # get the password
stty $OLDCONFIG # restore configuration
This saves the work station's configuration, turns
off echoing, reads a password, and restores the ori-
ginal configuration. The "` . . . `" (grave accents)
in the first command tell the shell to insert the
standard output of "stty -g" into the "OLDCONFIG= . .
. " command. This is called command substitution.
For more information, see "Command Substitution."
The "stty -echo" turns off echoing, which means that
the password does not appear on the screen when you
type it at the keyboard. This has nothing to do with
the echo command, which displays a message on the
screen
RELATED INFORMATION
The following command: "tabs."
The ioctl system call and the terminfo and config files
in AIX Operating System Technical Reference.
The discussion of stty and the "Overview of International
Character Support" in IBM RT PC Managing the AIX Oper-
ating System.