Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

tty(1)

curses(3)

ioctl(2)

tcsetattr(3)

tcgetattr(3)

ttyname(3)

termios(4)

stty(1)  —  Commands

NAME

stty − Sets terminal characteristics

SYNOPSIS

stty [-a | -g] [-f special-device]

stty [-f special-device] [argument ...]

The stty utility sets or reports on terminal I/O characteristics for the device that is its standard input. 

DESCRIPTION

Without flags or arguments specified, stty reports the settings of certain characteristics, usually those that differ from implementation-defined defaults; otherwise, stty modifies the terminal state according to the specified arguments.  Some combinations of arguments are mutually exclusive on some terminal types. 

Control Modes

The following arguments are available to set the terminal characteristics:

parenb (-parenb)
Enables (disables) parity generation and detection.

parodd (-parodd)
Selects odd (even) parity.

cs5 cs6 cs7 cs8
Selects character size, if possible.

numberSets terminal baud rate to the number given, if possible.  If the baud rate is set to zero, modem control is no longer asserted. 

ispeed number
Sets terminal input baud rate to the number given, if possible. If zero is specified, the input baud rate is set to be the same as the output baud rate.

ospeed number
Sets terminal output baud rate to the number given, if possible. If the output baud rate is set to zero, modem control is no longer asserted.

hupcl (-hupcl)
Stops asserting modem control (does not stop asserting modem control) 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.

nokerninfo (-nokerninfo)
Disables (enables) the printing of kernel-generated status information when the info control character is entered. 

Input Modes

echoctl (-echoctl)
Echoes control characters as ^X and <Delete> as ^?.  Prints two backspaces following the End-of-File character.  (Special characters are echoed as themselves.) 

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) newline to carriage-return on input.

igncr (-igncr)
Ignores (does not ignore) carriage-return on input.

icrnl (-icrnl)
Maps (does not map) carriage-return to newline on input.

imaxbel (-imaxbel)
Does (does not) ring bell on terminal when input buffer is full.

iuclc (-iuclc)
Maps (does not map) uppercase alphabetic characters to lowercase.

ixon (-ixon)
Enables (disables) Start/Stop output control.  Output from the system is stopped when the system receives Stop and started when the system receives Start.

ixany (-ixany)
Allows any character (allows only <Ctrl-q>) 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 alphabetic characters to uppercase on output.

onoeot (-onoeot)
Discards (keeps) End-of-Text on output.

onlcr (-onlcr)
Maps (does not map) newline characters to carriage-return/newline characters.

ocrnl (-ocrnl)
Maps (does not map) carriage-return/newline characters to newline characters.

onocr (-onocr)
Does not (does) output carriage-return characters at column 0 (zero).

onlret (-onlret)
Causes (does not cause) newline to perform the carriage-return function on the terminal.

ofill (-ofill)
Uses fill characters (uses timing) for delays.

ofdel (-ofdel)
Uses Delete (uses Null) characters for fill characters.

tabs (-tabs)
Maintains (expands to spaces) any tab characters in the output.

cr0 cr1 cr2 cr3
Selects style of delay for carriage-return characters.

nl0 nl1 nl2 nl32
Selects style of delay for newline characters.

tab0 tab1 tab2 tab3
Selects style of delay for horizontal tabs.

bs0 bs1Selects style of delay for backspaces. 

ff0 ff1Selects style of delay for form feeds. 

vt0 vt1Selects style of delay for vertical tabs. 

rows number
Specifies the number of lines this display can hold.

columns number (or cols number)
Specifies the number of characters per display line.

Local Modes

altwerase (-altwerase)
Uses (does not use) the altwerase mode, which defines a word as containing only alphanumeric characters and _ (underscore). 

isig (-isig)
Enables (disables) the checking of characters against the special control characters INTR, QUIT, and SUSP. 

icanon (-icanon)
Enables (disables) canonical input (Erase and Kill processing).

crtkill (-crtkill)
Echoes (does not echo) the Kill character by erasing the line in place like echoe. 

mdmbuf (-mdmbuf)
Uses (does not use) carrier as a flow control flag rather than sending a HANGUP signal. 

prterase (-prterase)
Prints (does not print) erased characters backwards within \ (backslash) and / (slash).

tostop (-tostop)
Stops (allows) output from background jobs to the terminal.

xcase (-xcase)
Echoes (does not echo) uppercase characters on input, and displays uppercase characters on output with a preceding \ (backslash).

iexten (-iexten)
Enables (disables) any implementation-defined special control-characters not currently controlled by icanon, isig, or ixon. 

echo (-echo)
Echoes back (does not echo back) every character typed.

echoe (-echoe)
Causes the Erase character to (to not) visually erase the last character in the current line from the display, if possible.

echok (-echok)
Echoes (does not echo) newline after the Kill character.

echonl (-echonl)
Echoes (does not echo) newline, even if echo is disabled. 

noflsh (-noflsh)
Disables (enables) flush after INTR, QUIT, SUSP. 

Control Assignments

special-character string
Sets special-character to string.  The special character is set to the first character in string and subsequent characters are ignored, with the following exceptions:

       •The stringss undef and ^- set the special character to {_POSIX_VDISABLE} if it is in effect for the device. 

       •The string ^? sets the special character to <Delete>. 

       •Any other string beginning with the character ^ sets the special character to the control character corresponding to the second character of string (subsequent characters are ignored).  For example, the string ^c sets the special character to ^C; the string ^zq sets the special character to ^Z. 

Note that you can set a special character to a control character in two ways: by entering the control character itself or by entering ^ and another character.  This allows you to enter a control characters that is already assigned to a special character without entering that special character; for example, you can enter ^C, even if it is already assigned to the intr special character, by entering ^ and then c. 

Recognized special-characters include dsusp, eof, eol, eol2, erase, discard, status, intr, kill, lnext, quit, reprint, start, stop, susp, and werase. 

saved settings
Sets the current terminal characteristics to the saved settings produced by the -g flag. 

min number

time number
Sets the value of min or time to number.  MIN and TIME are used in Non-Canonical mode input processing (-icanon). 

line number
Sets the line discipline to the specified number.

Combination Modes

evenp or parity
Enables parenb and cs7; disables parodd. 

oddpEnables 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)Enables (disables) icrnl and onlcr.  -nl also unsets inlcr, igncr ocrnl, and onlret. 

lcase (-lcase)

LCASE (-LCASE)
Sets (unsets) xcase, iuclc, and olcuc.  (Used for terminals with uppercase characters only.) 

saneResets all modes to some reasonable values. 

Compatibility Mode

ekResets Erase and Kill characters back to system defaults. 

lfkc (-lfkc)
Same as echok. 

flow (-flow)
Same as ixon (-ixon). 

tandem (-tandem)
Same as ixoff (-ixoff). 

decctlq (-decctlq)
Same as ixany (-ixany). 

decSets all modes suitable for terminals supplied by Digital Equipment Corporation.  (The control-character <Erase> is set to ^?). 

crterase (-crterase)

crtbs (-crtbs)
Same as echoe (-echoe). 

ctlecho (-ctlecho)
Same as echoctl (-echoctl). 

crt (-crt)

newcrt (-newcrt)
Sets (clears) echoe, echoke, and echoctl. 

litout (-litout)
Sends output characters with no (with) output processing.

xtabs (-xtabs)

oxtabs (-oxtabs)
Expands (does not expand) tabs to spaces.

fill (-fill)
Same as ofill (-ofill). 

all

everything
Same as -a. 

echoke (-echoke)

nohang (-nohang)
Does not (does) send HANGUP signal if carrier drops. 

nul-fillDoes character fill and uses Null character. 

del-fillDoes character fill and uses Delete character. 

tty33Sets modes suitable for the Teletype Corporation Model 33 terminal. 

tty37Sets modes suitable for the Teletype Corporation Model 37 terminal. 

vt05Sets modes suitable for the Digital Equipment Corporation Mode VT05 terminal. 

tn300Sets modes suitable for the General Electric TermiNet 300. 

ti700Sets modes suitable for the Texas Instruments 700 series. 

tekSets modes suitable for the Tektronix 4014 terminal. 

speedPrints only the line speed and a trailing semicolon (;). 

sizePrints only the terminal size. 

If no options are specified, an unspecified subset of the information displayed for the -a flag is displayed. 

If the terminal input speed and output speed are the same, the speed information is displayed as follows:

speed speed baud

Otherwise speeds are displayed as follows:

ispeed ispeed baud; ospeed ospeed baud;

Control-characters are displayed as follows:

control-character = value

where value is either the character, or some visual representation of the character if it is nonprinting, or the string undef if the character is disabled. 

The stty utility exits with one of the following values:

0The terminal options were read or set successfully. 

>0An error occurred. 

FLAGS

-aWrites to standard output all the current settings for the terminal. 

-f special-device
Allows you to specify an alternate terminal or tty device.  Normally, the stty command works on your standard input. 

-gWrites to standard output the current settings in an unspecified form that can be used as arguments to another stty utility on the same system. 

NOTES

The stty function is expected to be POSIX 1003.2 compatible. 

RELATED INFORMATION

Commands:  tty(1). 

Functions:  curses(3), ioctl(2), tcsetattr(3), tcgetattr(3), ttyname(3). 

Files:  termios(4). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026