stty(C) 06 January 1993 stty(C) Name stty, STTY - set the options for a terminal Syntax stty [ -a ] [ -g ] [ options ] Description The stty command sets certain terminal I/O options for the device that is the current standard input; without arguments, it reports the settings of certain options. With the -a option, stty reports all of the option set- tings. The -g option causes stty to output the current stty settings of the terminal as a list of fourteen hexadecimal numbers separated by colons. This output may be used as a command line argument to stty to restore these settings later on. It is a more compact form than stty -a. For example, the following shell script uses stty -g to store the current stty settings, then turns off character echo while reading a line of input. The stored stty values are then restored to the terminal: : echo "Enter your secret code: \c" old=`stty -g` stty -echo intr '^a' read code stty $old The various modes are discussed in several groups that follow. Detailed information about the modes listed in the first four groups may be found in termio(M). options in the last group are implemented using multiple options in the previous groups. Refer to vidi(C) for hardware specific information that describes control modes for the video monitor and other display devices. Common control modes parenb (-parenb) Enables (disables) parity generation and detection. parodd (-parodd) Selects odd (even) parity. cs5 cs6 cs7 cs8 Selects character size (see termio(M)). 0 Hangs up phone line immediately. 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 Sets terminal baud rate to the number given, if possi- ble. ospeed 50 75 110 134 150 200 300 600 1200 1800 3400 4800 9600 19200 38400 Sets terminal output baud rate separately. ispeed 50 75 110 134 150 200 300 600 1200 1800 3400 4800 9600 19200 38400 Sets terminal input baud rate separately. hupcl (-hupcl) Hangs up (does not hang up) phone connection 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. ctsflow (-ctsflow) Enables (disables) CTS handshaking for a modem or non- modem line. rtsflow (-rtsflow) Enables (disables) RTS handshaking for a modem or non- modem line. ortsfl (-ortsfl) Enables unidirectional (enables bidirectional) flow control if ctsflow and rtsflow are both set. The fol- lowing table shows the flow control modes available by combining the ortsfl, ctsflow, and rtsflow flags: _______________________________________________________ Flag settings Flow control mode _______________________________________________________ ortsfl rtsflow ctsflow Enable unidirectional flow control ortsfl rtsflow -ctsflow Assert RTS when ready to send ortsfl -rtsflow ctsflow No effect ortsfl -rtsflow -ctsflow Enable bidirectional flow control -ortsfl rtsflow ctsflow Enable bidirectional flow control -ortsfl rtsflow -ctsflow No effect -ortsfl -rtsflow ctsflow Stop transmission when CTS drops -ortsfl -rtsflow -ctsflow Disable hardware flow control Input modes ignbrk (-ignbrk) Ignores (does not ignore) break on input. brkint (-brkint) Signals (does not signal) INTERRUPT on break. ignpar (-ignpar) Ignores (does not ignore) parity errors. parmrk (-parmrk) Marks (does not mark) parity errors (see termio(M)). inpck (-inpck) Enables (disables) input parity checking. istrip (-istrip) Strips (does not strip) input characters 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 alphabetics to lowercase on input. ixon (-ixon) Enables (disables) START/STOP output control. Output is stopped by sending an ASCII DC3 and started by send- ing an ASCII DC1. ixany (-ixany) Allows any character (only DC1) to restart output. ixoff (-ixoff) Requests that the system send (not send) START/STOP characters when the input queue is nearly empty/full. isscancode (-isscancode) Expect the terminal device to send (not send) PC scancodes. xscancode (-xscancode) Translate (do not translate) PC scancodes to characters on input. cs2scancode (-cs2scancode) Put console keyboard into codeset 2/(AT) mode (or codeset 1/(XT) mode) and interpret the transmitted codes accordingly. Do not use the -iscancode or -xscancode options on the console, as the console keyboard always sends scancodes and needs them translated. Some console keyboards do not support AT mode. Use kbmode(ADM) to deter- mine whether your keyboard supports this mode. The stty -a command displays these option settings (along with the set- tings of all other options). However, if the tty is in -isscancode mode, stty -a does not display the state of xscancode cs2scancode. Output modes opost (-opost) Post-processes output (does not post-process output; ignores all other output modes). olcuc (-olcuc) Maps (does not map) lowercase alphabetics to uppercase on output. onlcr (-onlcr) Maps (does not map) NL to CR-NL on output. ocrnl (-ocrnl) Maps (does not map) CR to NL on output. onocr (-onocr) Does not (does) output CRs 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) Fill characters are DELETEs (NULs). cr0 cr1 cr2 cr3 Selects style of delay for RETURNs (see termio(M)). nl0 nl1 Selects style of delay for LINEFEEDs (see termio(M)). tab0 tab1 tab2 tab3 Selects style of delay for horizontal TABs (see termio(M)). bs0 bs1 Selects style of delay for BACKSPACEs (see termio(M)). ff0 ff1 Selects style of delay for FORMFEEDs (see termio(M)). vt0 vt1 Selects style of delay for vertical TABs (see termio(M)). Local modes isig (-isig) Enables (disables) the checking of characters against the special control characters INTERRUPT, SWITCH and QUIT. icanon (-icanon) Enables (disables) canonical input (ERASE and KILL processing). xcase (-xcase) Canonical (unprocessed) upper/lowercase presentation. echo (-echo) Echoes back (does not echo back) every character typed. echoe (-echoe) Echoes (does not echo) ERASE character as a backspace, space, backspace sequence. Note: this mode will erase the ERASE character on many CRT terminals; however, it does not keep track of column position and, as a result, may be confusing on escaped characters, TABs, and BACKSPACEs. echok (-echok) Echoes (does not echo) NL after KILL character. lfkc (-lfkc) The same as echok (-echok); obsolete. echonl (-echonl) Echoes (does not echo) NL. noflsh (-noflsh) Disables (enables) flush after INTERRUPT or QUIT. iexten (-iexten) Enables extended implementation (implementation- defined) functions. tostop (-tostop) Disables/enables background process group to write to controlling terminal (only if job control is sup- ported). Control assignments control-character C Sets control-character to C, where control-character is erase, kill, intr (interrupt), quit, eof, eol, swtch (switch), start, stop or susp. start and stop are available as possible control char- acters for the control-character C assignment. If C is preceded by a caret (^) (escaped from the shell), then the value used is the corresponding con- trol character (for example, ^D is a <Ctrl>d; ^? is interpreted as DELETE and ^- is interpreted as unde- fined). min i, time i (0 < i < 127) When -icanon is set, and one character has been received, read requests are not satisfied until at least min characters have been received or the timeout value time has expired and one character has been received. See termio(M). line i Sets the line discipline to i (0 < i < 127). Combination modes evenp or parity Enables parenb and cs7. oddp Enables parenb, cs7, and parodd. -parity, -evenp, or -oddp Disables parenb, and sets cs8. raw (-raw or cooked) Enables (disables) raw input and output (no ERASE, KILL, INTERRUPT, QUIT, EOT, or output post-processing). nl (-nl) Unsets (sets) icrnl, onlcr. In addition -nl unsets inlcr, igncr, ocrnl, and onlret. lcase (-lcase) Sets (unsets) xcase, iuclc, and olcuc. LCASE (-LCASE) Same as lcase (-lcase). tabs (-tabs or tab3) Preserves (expands to spaces) tabs when printing. ek Resets ERASE and KILL characters back to normal <Ctrl>h and <Ctrl>u. sane Resets all modes to some reasonable values. Useful when a terminal's settings have been hopelessly scram- bled. This includes setting xscancode if isscancode is set. term Sets all modes suitable for the terminal type term, where term is one of tty33, tty37, vt05, tn300, ti700, or tek. See also console(M), kbmode(ADM), ioctl(S), scancode(HW), scanon(M), termio(M), termios(M), tty(M) and vidi(C). Notes Many combinations of options make no sense, but no checking is performed. Standards conformance stty is conformant with: AT&T SVID Issue 2; and X/Open Portability Guide, Issue 3, 1989.