home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


stty [options ] [modes ]

Set terminal I/O options for the current device. Without options, stty reports the terminal settings, where a ^ indicates the Control key, and ^` indicates a null value. Most modes can be switched using an optional preceding - (shown in brackets). The corresponding description is also shown in brackets. As a privileged user, you can set or read settings from another device using the syntax:


] [modes
] <


stty is one of the most complicated Unix commands. The complexity stems from the need to deal with a large range of conflicting, incompatible, and nonstandardized terminal devices -- everything from printing teletypes to CRTs to pseudo-terminals for windowing systems. Only a few of the options are really needed for day-to-day use. stty sane is a particularly valuable one to remember.



Report all option settings.


Report current settings.

Control Modes


Hang up connection (set the baud rate to zero).


Set terminal baud rate to n (e.g., 19200 ).

[- ]clocal

[Enable] disable modem control.

[- ]cread

[Disable] enable the receiver.

[- ]crtscts

[Disable] enable output hardware flow control using RTS/CTS.

[- ]crtsxoff

[Disable] enable input hardware flow control using RTS.

cs n

Select character size in bits (5 <= n <= 8).

[- ]cstopb

[One] two stop bits per character.


Set the width in bytes per character and screen display columns per character, for EUC (Extended Unix Code) characters. Solaris only.

[- ]hup

[Do not] hang up connection on last close.

[- ]hupcl

Same as [- ]hup .

ispeed n

Set terminal input baud rate to n .

[- ]loblk

[Do not] block layer output. For use with shl ; obsolete.

ospeed n

Set terminal output baud rate to n .

[- ]parenb

[Disable] enable parity generation and detection.

[- ]parext

[Disable] enable extended parity generation and detection for mark and space parity.

[- ]parodd

Use [even] odd parity.

Input Modes

[- ]brkint

[Do not] signal INTR on break.

[- ]icrnl

[Do not] map carriage return (^M ) to newline (^J ) on input.

[- ]ignbrk

[Do not] ignore break on input.

[- ]igncr

[Do not] ignore carriage return on input.

[- ]ignpar

[Do not] ignore parity errors.

[- ]imaxbel

[Do not] echo BEL when input line is too long.

[- ]inlcr

[Do not] map newline to carriage return on input.

[- ]inpck

[Disable] enable input parity checking.

[- ]istrip

[Do not] strip input characters to 7 bits.

[- ]iuclc

[Do not] map uppercase to lowercase on input.

[- ]ixany

Allow [only XON] any character to restart output.

[- ]ixoff

[Do not] send START/STOP characters when the queue is nearly empty/full.

[- ]ixon

[Disable] enable START/STOP output control.

[- ]parmrk

[Do not] mark parity errors.

Output Modes

bs n

Select style of delay for backspaces (n = 0 or 1).

cr n

Select style of delay for carriage returns (0 <= n <= 3).

ff n

Select style of delay for formfeeds (n = 0 or 1).

nl n

Select style of delay for linefeeds (n = 0 or 1).

[- ]ocrnl

[Do not] map carriage return to newline on output.

[- ]ofdel

Set fill character to [NULL] DEL.

[- ]ofill

Delay output with [timing] fill characters.

[- ]olcuc

[Do not] map lowercase to uppercase on output.

[- ]onlcr

[Do not] map newline to carriage return-newline on output.

[- ]onlret

[Do not] perform carriage return after newline.

[- ]onocr

[Do not] output carriage returns at column zero.

[- ]opost

[Do not] postprocess output; ignore all other output modes.

tab n

Select style of delay for horizontal tabs (0 <= n <= 3).

vt n

Select style of delay for vertical tabs (n = 0 or 1).

Local Modes

[- ]echo

[Do not] echo every character typed.

[- ]echoctl

[Do not] echo control characters as ^ char , DEL as ^? .

[- ]echoe

[Do not] echo ERASE character as BS-space-BS string.

[- ]echok

[Do not] echo newline after KILL character.

[- ]echoke

[Do not] BS-SP-BS erase entire line on line kill.

[- ]echonl

[Do not] echo newline (^J ).

[- ]echoprt

[Do not] echo erase character as character is "erased."

[- ]flusho

Output is [not] being flushed.

[- ]icanon

[Disable] enable canonical input (ERASE and KILL processing).

[- ]iexten

[Disable] enable extended functions for input data.

[- ]isig

[Disable] enable checking of characters against INTR, QUIT, and SWITCH.

[- ]lfkc

Same as [- ]echok . Obsolete.

[- ]noflsh

[Enable] disable flush after INTR, QUIT, or SWITCH.

[- ]pendin

[Do not] retype pending input at next read or input character.

[- ]stappl

[Line] application mode on a synchronous line.

[- ]stflush

[Disable] enable flush on synchronous line.

[- ]stwrap

[Enable] disable truncation on synchronous line.

[- ]tostop

[Do not] send SIGTTOU when background processes write to the terminal.

[- ]xcase

[Do not] change case on local output.

Control Assignments

ctrl-char c

Set control character to c . ctrl-char is: ctab , discard , dsusp , eof , eol , eol2 , erase , intr , kill , lnext , quit , reprint , start , stop , susp , swtch , werase .

min n

With -icanon , n is the minimum number of characters that will satisfy the read system call until the timeout set with time expires.

time n

With -icanon , n is the number of tenths of seconds to wait before a read system call times out. If the minimum number of characters set with min has been read, the read can return before the timeout expires.

line i

Set line discipline to i (1 <= i <= 126).

Combination Modes


Set normal asynchronous communications.


Same as -raw .

[- ]evenp

Same as [- ]parenb and cs7 [8 ].


Reset ERASE and KILL characters to # and @ .

[- ]lcase

[Un] set xcase , iuclc , and olcuc .


Same as [- ]lcase .

[- ]markp

[Disable] enable parenb , parodd , and parext , and set cs 7 [8 ].

[- ]nl

[Un] set icrnl and onlcr . -nl also unsets inlcr , igncr , ocrnl , and onlret .

[- ]oddp

Same as [- ]parenb , [- ]parodd , and cs7 [8 ].

[- ]parity

Same as [- ]parenb and cs 7 [8 ].

[- ]raw

[Disable] enable raw input and output (no ERASE, KILL, INTR, QUIT, EOT, SWITCH, or output postprocessing).


Reset all modes to reasonable values.

[- ]spacep

[Disable] enable parenb and parext , and set cs7 [8 ].

[- ]tabs

[Expand to spaces] preserve output tabs.


Set all modes suitable for terminal type term (tty33 , tty37 , vt05 , tn300 , ti700 , or tek ). (These predefined names are all so obsolete as to be useless.)

Hardware Flow Control Modes

[- ]cdxon

[Disable] enable CD on output.

[- ]ctsxon

[Disable] enable CTS on output.

[- ]dtrxoff

[Disable] enable DTR on input.

[- ]isxoff

[Disable] enable isochronous hardware flow control on input.

[- ]rtsxoff

[Disable] enable RTS on input.

Clock Modes

These options may not be supported on all hardware:

[x |r ]cibrg

Get the transmit|receive clock from internal baud rate generator.

[x |r ]ctset

Get the transmit|receive clock from transmitter timing-lead, CCITT V.24 circuit 114, EIA-232-D pin 15.

[x |r ]crset

Get the transmit|receive clock from receiver timing-lead, CCITT V.24 circuit 115, EIA-232-D pin 17.

For modes beginning with t , pin is transmitter timing-lead, V.24 circuit 113, EIA-232-D pin 24. For modes beginning with r , pin is receiver timing-lead, V.24 circuit 128, no EIA-232-D pin.

[t |r ]setcoff

No transmitter|receiver timing clock.

[t |r ]setcrbrg

Send receive baud rate generator to pin .

[t |r ]setctbrg

Send transmit baud rate generator to pin .

[t |r ]setctset

Send transmitter timing to pin .

[t |r ]setcrset

Send receiver timing to pin .

Window size

columns n

Set size to n columns. Can also be given as cols .

rows n

Set size to n rows.

xpixels n

Set size to n pixels across.

ypixels n

Set size to n pixels up and down.

Previous: Reference: strip UNIX in a Nutshell: System V Edition Next: Reference: su
Reference: strip Book Index Reference: su

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System