STTY(1) BSD Reference Manual STTY(1) NNAAMMEE ssttttyy - set the options for a terminal device interface SSYYNNOOPPSSIISS ssttttyy [--aa | --ee | --gg] [--ff _f_i_l_e] [operands] DDEESSCCRRIIPPTTIIOONN The ssttttyy utility sets or reports on terminal characteristics for the de- vice that is its standard input. If no options or operands are speci- fied, it reports the settings of a subset of characteristics as well as additional ones if they differ from their default values. Otherwise it modifies the terminal state according to the specified arguments. Some combinations of arguments are mutually exclusive on some terminal types. The following options are available: --aa Display all the current settings for the terminal to standard output as per IEEE Std1003.2 (``POSIX''). --ee Display all the current settings for the terminal to standard output in the traditional BSD ``all'' and ``everything'' formats. --ff Open and use the terminal named by _f_i_l_e rather than using stan- dard input. The file is opened using the O_NONBLOCK flag of ooppeenn(), making it possible to set or display settings on a termi- nal that might otherwise block on the open. --gg Display all the current settings for the terminal to standard output in a form that may be used as an argument to a subsequent invocation of ssttttyy to restore the current terminal state as per IEEE Std1003.2 (``POSIX''). The following arguments are available to set the terminal characteris- tics: CCoonnttrrooll MMooddeess:: Control mode flags affect hardware characteristics associated with the terminal. This corresponds to the c_cflag in the termios structure. ppaarreennbb (--ppaarreennbb) Enable (disable) parity generation and detection. ppaarroodddd (--ppaarroodddd) Select odd (even) parity. ccss55 ccss66 ccss77 ccss88 Select character size, if possible. _n_u_m_b_e_r Set terminal baud rate to the number given, if possible. If the baud rate is set to zero, modem control is no longer as- serted. iissppeeeedd _n_u_m_b_e_r Set terminal input baud rate to the number given, if possi- ble. If the input baud rate is set to zero, the input baud rate is set to the value of the output baud rate. oossppeeeedd _n_u_m_b_e_r Set terminal output baud rate to the number given, if possi- ble. If the output baud rate is set to zero, modem control is no longer asserted. ssppeeeedd _n_u_m_b_e_r This sets both iissppeeeedd and oossppeeeedd to _n_u_m_b_e_r. hhuuppccll (--hhuuppccll) Stop asserting modem control (do not stop asserting modem control) on last close. hhuupp (--hhuupp) Same as hupcl (--hhuuppccll). ccssttooppbb (--ccssttooppbb) Use two (one) stop bits per character. ccrreeaadd (--ccrreeaadd) Enable (disable) the receiver. ccllooccaall (--ccllooccaall) Assume a line without (with) modem control. ccrrttssccttss (--ccrrttssccttss) Enable RTS/CTS flow control. IInnppuutt MMooddeess:: This corresponds to the c_iflag in the termios structure. iiggnnbbrrkk (--iiggnnbbrrkk) Ignore (do not ignore) break on input. bbrrkkiinntt (--bbrrkkiinntt) Signal (do not signal) INTR on break. iiggnnppaarr (--iiggnnppaarr) Ignore (do not ignore) parity errors. ppaarrmmrrkk (--ppaarrmmrrkk) Mark (do not mark) parity errors. iinnppcckk (--iinnppcckk) Enable (disable) input parity checking. iissttrriipp (--iissttrriipp) Strip (do not strip) input characters to seven bits. iinnllccrr (--iinnllccrr) Map (do not map) NL to CR on input. iiggnnccrr (--iiggnnccrr) Ignore (do not ignore) CR on input. iiccrrnnll (--iiccrrnnll) Map (do not map) CR to NL on input. iixxoonn (--iixxoonn) Enable (disable) START/STOP output control. Output from the system is stopped when the system receives STOP and started when the system receives START, or if iixxaannyy is set, any char- acter restarts output. iixxooffff (--iixxooffff) Request that the system send (not send) START/STOP characters when the input queue is nearly empty/full. iixxaannyy (--iixxaannyy) Allow any character (allow only START) to restart output. iimmaaxxbbeell (--iimmaaxxbbeell) The system imposes a limit of MAX_INPUT (currently 255) char- acters in the input queue. If iimmaaxxbbeell is set and the input queue limit has been reached, subsequent input causes the system to send an ASCII BEL character to the output queue (the terminal beeps at you). Otherwise, if iimmaaxxbbeell is unset and the input queue is full, the next input character causes the entire input and output queues to be discarded. OOuuttppuutt MMooddeess:: This corresponds to the c_oflag of the termios structure. ooppoosstt (--ooppoosstt) Post-process output (do not post-process output; ignore all other output modes). oonnllccrr (--oonnllccrr) Map (do not map) NL to on output. ooxxttaabbss (--ooxxttaabbss) Expand (do not expand) tabs to spaces on output. LLooccaall MMooddeess:: Local mode flags (lflags) affect various and sundry characteristics of terminal processing. Historically the term "local" pertained to new job control features implemented by Jim Kulp on a Pdp 11/70 at IIASA. Later the driver ran on the first VAX at Evans Hall, UC Berkeley, where the job control details were greatly modified but the structure definitions and names remained essentially unchanged. The second interpretation of the 'l' in lflag is ``line discipline flag'' which corresponds to the _c___l_f_l_a_g of the _t_e_r_m_i_o_s structure. iissiigg (--iissiigg) Enable (disable) the checking of characters against the spe- cial control characters INTR, QUIT, and SUSP. iiccaannoonn (--iiccaannoonn) Enable (disable) canonical input (ERASE and KILL processing). iieexxtteenn (--iieexxtteenn) Enable (disable) any implementation defined special control characters not currently controlled by icanon, isig, or ixon. eecchhoo (--eecchhoo) Echo back (do not echo back) every character typed. eecchhooee (--eecchhooee) The ERASE character shall (shall not) visually erase the last character in the current line from the display, if possible. eecchhookk (--eecchhookk) Echo (do not echo) NL after KILL character. eecchhookkee (--eecchhookkee) The KILL character shall (shall not) visually erase the the current line from the display, if possible. eecchhoonnll (--eecchhoonnll) Echo (do not echo) NL, even if echo is disabled. eecchhooccttll (--eecchhooccttll) If eecchhooccttll is set, echo control characters as ^X. Otherwise control characters echo as themselves. eecchhoopprrtt (--eecchhoopprrtt) For printing terminals. If set, echo erased characters back- wards within ``\'' and ``/''. Otherwise, disable this fea- ture. nnooffllsshh (--nnooffllsshh) Disable (enable) flush after INTR, QUIT, SUSP. ttoossttoopp (--ttoossttoopp) Send (do not send) SIGTTOU for background output. This caus- es background jobs to stop if they attempt terminal output. aallttwweerraassee (--aallttwweerraassee) Use (do not use) an alternate word erase algorithm when pro- cessing WERASE characters. This alternate algorithm consid- ers sequences of alphanumeric/underscores as words. It also skips the first preceding character in its classification (as a convenience since the one preceding character could have been erased with simply an ERASE character.) mmddmmbbuuff (--mmddmmbbuuff) If set, flow control output based on condition of Carrier De- tect. Otherwise writes return an error if Carrier Detect is low (and Carrier is not being ignored with the CLOCAL flag.) fflluusshhoo (--fflluusshhoo) Indicates output is (is not) being discarded. ppeennddiinn (--ppeennddiinn) Indicates input is (is not) pending after a switch from non- canonical to canonical mode and will be re-input when a read becomes pending or more input arrives. CCoonnttrrooll CChhaarraacctteerrss:: _c_o_n_t_r_o_l_-_c_h_a_r_a_c_t_e_r _s_t_r_i_n_g Set _c_o_n_t_r_o_l_-_c_h_a_r_a_c_t_e_r to _s_t_r_i_n_g. If string is a single char- acter, the control character is set to that character. If string is the two character sequence "^-" or the string "un- def" the control character is disabled (i.e. set to {_POSIX_VDISABLE}.) Recognized control-characters: control- character Subscript Description _________ _________ _______________ eof VEOF EOF character eol VEOL EOL character eol2 VEOL2 EOL2 character erase VERASE ERASE character werase VWERASE WERASE character intr VINTR INTR character kill VKILL KILL character quit VQUIT QUIT character susp VSUSP SUSP character start VSTART START character stop VSTOP STOP character dsusp VDSUSP DSUSP character lnext VLNEXT LNEXT character reprint VREPRINT REPRINT character status VSTATUS STATUS character mmiinn _n_u_m_b_e_r ttiimmee _n_u_m_b_e_r Set the value of min or time to number. MIN and TIME are used in Non-Canonical mode input processing (-icanon). CCoommbbiinnaattiioonn MMooddeess:: _s_a_v_e_d _s_e_t_t_i_n_g_s Set the current terminal characteristics to the saved set- tings produced by the --gg option. eevveennpp or ppaarriittyy Enable parenb and cs7; disable parodd. ooddddpp Enable parenb, cs7, and parodd. --ppaarriittyy, --eevveennpp, --ooddddpp Disable parenb, and set cs8. nnll (--nnll) Enable (disable) icrnl. In addition -nl unsets inlcr and igncr. eekk Reset ERASE and KILL characters back to system defaults. ssaannee Resets all modes to reasonable values for interactive termi- nal use. ttttyy Set the line discipline to the standard terminal line disci- pline TTYDISC. ccrrtt (--ccrrtt) Set (disable) all modes suitable for a CRT display device. kkeerrnniinnffoo (--kkeerrnniinnffoo) Enable (disable) the system generated status line associated with processing a STATUS character (usually set to ^T). The status line consists of the system load average, the current command name, its process ID, the event the process is wait- ing on (or the status of the process), the user and system times, percent cpu, and current memory usage. ccoolluummnnss _n_u_m_b_e_r The terminal size is recorded as having _n_u_m_b_e_r columns. ccoollss _n_u_m_b_e_r is an alias for ccoolluummnnss.. rroowwss _n_u_m_b_e_r The terminal size is recorded as having _n_u_m_b_e_r rows. ddeecc Set modes suitable for users of Digital Equipment Corporation systems ( ERASE, KILL, and INTR characters are set to ^?, ^U, and ^C; ixany is disabled, and crt is enabled.) eexxttpprroocc (--eexxttpprroocc) If set, this flag indicates that some amount of terminal pro- cessing is being performed by either the terminal hardware or by the remote side connected to a pty. rraaww (--rraaww) If set, change the modes of the terminal so that no input or output processing is performed. If unset, change the modes of the terminal to some reasonable state that performs input and output processing. Note that since the terminal driver no longer has a single RAW bit, it is not possible to intuit what flags were set prior to setting rraaww. This means that un- setting rraaww may not put back all the setting that were previ- ously in effect. To set the terminal into a raw state and then accurately restore it, the following shell code is rec- ommended: save_state=$(stty -g) stty raw ... stty "$save_state" ssiizzee The size of the terminal is printed as two numbers on a sin- gle line, first rows, then columns. CCoommppaattiibbiilliittyy MMooddeess:: These modes remain for compatibility with the previous version of the stty command. aallll Reports all the terminal modes as with ssttttyy --aa except that the control characters are printed in a columnar format. eevveerryytthhiinngg Same as aallll. ccooookkeedd Same as ssaannee. ccbbrreeaakk If set, enables bbrrkkiinntt, iixxoonn, iimmaaxxbbeell, ooppoosstt, iissiigg, iieexxtteenn, and --iiccaannoonn. If unset, same as ssaannee. nneeww Same as ttttyy. oolldd Same as ttttyy. nneewwccrrtt (--nneewwccrrtt) Same as ccrrtt. ppaassss88 The converse of ppaarriittyy. ttaannddeemm (--ttaannddeemm) Same as iixxooffff. ddeeccccttllqq (--ddeeccccttllqq) The converse of iixxaannyy. ccrrtteerraassee (--ccrrtteerraassee) Same as eecchhooee. ccrrttbbss (--ccrrttbbss) Same as eecchhooee. ccrrttkkiillll (--ccrrttkkiillll) Same as eecchhookkee. ccttlleecchhoo (--ccttlleecchhoo) Same as eecchhooccttll. pprrtteerraassee (--pprrtteerraassee) Same as eecchhoopprrtt. lliittoouutt (--lliittoouutt) The converse of ooppoosstt. ttaabbss (--ttaabbss) The converse of ttaabbss. bbrrkk _v_a_l_u_e Same as the control character eeooll. fflluusshh _v_a_l_u_e Same as the control character ddiissccaarrdd. rrpprrnntt _v_a_l_u_e Same as the control character rreepprriinntt. The ssttttyy utility exits with a value of 0 if successful, and >0 if an er- ror occurs. SSEEEE AALLSSOO termios(4) SSTTAANNDDAARRDDSS The ssttttyy function is expected to be IEEE Std1003.2 (``POSIX'') compati- ble. The flags --ee and --ff are extensions to the standard. 4.4BSD June 1, 1994 7