1STTY(1P)                   POSIX Programmer's Manual                  STTY(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       stty — set the options for a terminal
13

SYNOPSIS

15       stty [-a|-g]
16
17       stty operand...
18

DESCRIPTION

20       The stty utility shall set or report on  terminal  I/O  characteristics
21       for  the device that is its standard input. Without options or operands
22       specified, it shall report the  settings  of  certain  characteristics,
23       usually those that differ from implementation-defined defaults.  Other‐
24       wise, it shall modify the terminal state according to the specified op‐
25       erands.  Detailed  information about the modes listed in the first five
26       groups  below  are  described  in  the  Base  Definitions   volume   of
27       POSIX.1‐2017,  Chapter 11, General Terminal Interface.  Operands in the
28       Combination Modes group (see Combination Modes) are  implemented  using
29       operands  in  the  previous  groups.  Some combinations of operands are
30       mutually-exclusive on some terminal types; the results  of  using  such
31       combinations are unspecified.
32
33       Typical  implementations  of this utility require a communications line
34       configured to use the termios interface defined in  the  System  Inter‐
35       faces  volume of POSIX.1‐2017. On systems where none of these lines are
36       available, and on lines not currently configured to support the termios
37       interface,  some  of the operands need not affect terminal characteris‐
38       tics.
39

OPTIONS

41       The stty utility shall  conform  to  the  Base  Definitions  volume  of
42       POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
43
44       The following options shall be supported:
45
46       -a        Write  to  standard  output  all the current settings for the
47                 terminal.
48
49       -g        Write to standard output  all  the  current  settings  in  an
50                 unspecified  form  that  can  be used as arguments to another
51                 invocation of the stty utility on the same system.  The  form
52                 used  shall  not  contain  any  characters that would require
53                 quoting to avoid word expansion by  the  shell;  see  Section
54                 2.6, Word Expansions.
55

OPERANDS

57       The  following  operands shall be supported to set the terminal charac‐
58       teristics.
59
60   Control Modes
61       parenb (-parenb)
62                   Enable (disable)  parity  generation  and  detection.  This
63                   shall  have  the  effect of setting (not setting) PARENB in
64                   the termios c_cflag field, as defined in the  Base  Defini‐
65                   tions  volume of POSIX.1‐2017, Chapter 11, General Terminal
66                   Interface.
67
68       parodd (-parodd)
69                   Select odd (even) parity. This shall  have  the  effect  of
70                   setting  (not setting) PARODD in the termios c_cflag field,
71                   as defined in the Base Definitions volume of  POSIX.1‐2017,
72                   Chapter 11, General Terminal Interface.
73
74       cs5 cs6 cs7 cs8
75                   Select  character  size,  if  possible. This shall have the
76                   effect of setting CS5, CS6, CS7, and CS8, respectively,  in
77                   the  termios  c_cflag field, as defined in the Base Defini‐
78                   tions volume of POSIX.1‐2017, Chapter 11, General  Terminal
79                   Interface.
80
81       number      Set terminal baud rate to the number given, if possible. If
82                   the baud rate is set to zero, the modem control lines shall
83                   no  longer  be asserted. This shall have the effect of set‐
84                   ting the input and  output  termios  baud  rate  values  as
85                   defined  in  the  Base  Definitions volume of POSIX.1‐2017,
86                   Chapter 11, General Terminal Interface.
87
88       ispeed number
89                   Set terminal input baud rate to the number given, if possi‐
90                   ble.  If the input baud rate is set to zero, the input baud
91                   rate shall be specified by the value  of  the  output  baud
92                   rate.  This  shall  have  the  effect  of setting the input
93                   termios baud rate values as defined in the Base Definitions
94                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
95                   face.
96
97       ospeed number
98                   Set terminal output baud rate to the number given, if  pos‐
99                   sible.  If  the  output baud rate is set to zero, the modem
100                   control lines shall no longer be asserted. This shall  have
101                   the  effect  of setting the output termios baud rate values
102                   as defined in the Base Definitions volume of  POSIX.1‐2017,
103                   Chapter 11, General Terminal Interface.
104
105       hupcl (-hupcl)
106                   Stop  asserting  modem control lines (do not stop asserting
107                   modem control lines) on last close.  This  shall  have  the
108                   effect  of  setting  (not  setting)  HUPCL  in  the termios
109                   c_cflag field, as defined in the Base Definitions volume of
110                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
111
112       hup (-hup)  Equivalent to hupcl(-hupcl).
113
114       cstopb (-cstopb)
115                   Use  two (one) stop bits per character. This shall have the
116                   effect of setting  (not  setting)  CSTOPB  in  the  termios
117                   c_cflag field, as defined in the Base Definitions volume of
118                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
119
120       cread (-cread)
121                   Enable (disable) the receiver. This shall have  the  effect
122                   of  setting  (not  setting)  CREAD  in  the termios c_cflag
123                   field,  as  defined  in  the  Base  Definitions  volume  of
124                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
125
126       clocal (-clocal)
127                   Assume a line without (with) modem control. This shall have
128                   the effect of setting (not setting) CLOCAL in  the  termios
129                   c_cflag field, as defined in the Base Definitions volume of
130                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
131
132       It is unspecified whether stty shall report an error if an  attempt  to
133       set a Control Mode fails.
134
135   Input Modes
136       ignbrk (-ignbrk)
137                   Ignore  (do not ignore) break on input. This shall have the
138                   effect of setting  (not  setting)  IGNBRK  in  the  termios
139                   c_iflag field, as defined in the Base Definitions volume of
140                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
141
142       brkint (-brkint)
143                   Signal (do not signal) INTR on break. This shall  have  the
144                   effect  of  setting  (not  setting)  BRKINT  in the termios
145                   c_iflag field, as defined in the Base Definitions volume of
146                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
147
148       ignpar (-ignpar)
149                   Ignore (do not ignore) bytes with parity errors. This shall
150                   have the effect of setting  (not  setting)  IGNPAR  in  the
151                   termios  c_iflag  field, as defined in the Base Definitions
152                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
153                   face.
154
155       parmrk (-parmrk)
156                   Mark  (do  not  mark)  parity  errors.  This shall have the
157                   effect of setting  (not  setting)  PARMRK  in  the  termios
158                   c_iflag field, as defined in the Base Definitions volume of
159                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
160
161       inpck (-inpck)
162                   Enable (disable) input parity checking. This shall have the
163                   effect  of  setting  (not  setting)  INPCK  in  the termios
164                   c_iflag field, as defined in the Base Definitions volume of
165                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
166
167       istrip (-istrip)
168                   Strip  (do  not strip) input characters to seven bits. This
169                   shall have the effect of setting (not  setting)  ISTRIP  in
170                   the  termios  c_iflag field, as defined in the Base Defini‐
171                   tions volume of POSIX.1‐2017, Chapter 11, General  Terminal
172                   Interface.
173
174       inlcr (-inlcr)
175                   Map  (do  not  map)  NL to CR on input. This shall have the
176                   effect of  setting  (not  setting)  INLCR  in  the  termios
177                   c_iflag field, as defined in the Base Definitions volume of
178                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
179
180       igncr (-igncr)
181                   Ignore (do not ignore) CR on input.  This  shall  have  the
182                   effect  of  setting  (not  setting)  IGNCR  in  the termios
183                   c_iflag field, as defined in the Base Definitions volume of
184                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
185
186       icrnl (-icrnl)
187                   Map  (do  not  map)  CR to NL on input. This shall have the
188                   effect of  setting  (not  setting)  ICRNL  in  the  termios
189                   c_iflag field, as defined in the Base Definitions volume of
190                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
191
192       ixon (-ixon)
193                   Enable (disable) START/STOP output control. Output from the
194                   system is stopped when the system receives STOP and started
195                   when the system receives START. This shall have the  effect
196                   of setting (not setting) IXON in the termios c_iflag field,
197                   as defined in the Base Definitions volume of  POSIX.1‐2017,
198                   Chapter 11, General Terminal Interface.
199
200       ixany (-ixany)
201                   Allow  any character to restart output. This shall have the
202                   effect of  setting  (not  setting)  IXANY  in  the  termios
203                   c_iflag field, as defined in the Base Definitions volume of
204                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
205
206       ixoff (-ixoff)
207                   Request that the system send  (not  send)  STOP  characters
208                   when the input queue is nearly full and START characters to
209                   resume data transmission.  This shall have  the  effect  of
210                   setting  (not  setting) IXOFF in the termios c_iflag field,
211                   as defined in the Base Definitions volume of  POSIX.1‐2017,
212                   Chapter 11, General Terminal Interface.
213
214   Output Modes
215       opost (-opost)
216                   Post-process output (do not post-process output; ignore all
217                   other output modes). This shall have the effect of  setting
218                   (not  setting)  OPOST  in  the  termios  c_oflag  field, as
219                   defined in the Base  Definitions  volume  of  POSIX.1‐2017,
220                   Chapter 11, General Terminal Interface.
221
222       onlcr (-onlcr)
223                   Map (do not map) NL to CR-NL on output. This shall have the
224                   effect of  setting  (not  setting)  ONLCR  in  the  termios
225                   c_oflag field, as defined in the Base Definitions volume of
226                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
227
228       ocrnl (-ocrnl)
229                   Map (do not map) CR to NL on output. This  shall  have  the
230                   effect  of  setting  (not  setting)  OCRNL  in  the termios
231                   c_oflag field, as defined in the Base Definitions volume of
232                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
233
234       onocr (-onocr)
235                   Do  not  (do) output CR at column zero. This shall have the
236                   effect of  setting  (not  setting)  ONOCR  in  the  termios
237                   c_oflag field, as defined in the Base Definitions volume of
238                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
239
240       onlret (-onlret)
241                   The terminal newline key performs (does not perform) the CR
242                   function.   This shall have the effect of setting (not set‐
243                   ting) ONLRET in the termios c_oflag field,  as  defined  in
244                   the  Base  Definitions  volume of POSIX.1‐2017, Chapter 11,
245                   General Terminal Interface.
246
247       ofill (-ofill)
248                   Use fill characters (use timing)  for  delays.  This  shall
249                   have  the  effect  of  setting  (not  setting) OFILL in the
250                   termios c_oflag field, as defined in the  Base  Definitions
251                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
252                   face.
253
254       ofdel (-ofdel)
255                   Fill characters are DELs (NULs). This shall have the effect
256                   of  setting  (not  setting)  OFDEL  in  the termios c_oflag
257                   field,  as  defined  in  the  Base  Definitions  volume  of
258                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
259
260       cr0 cr1 cr2 cr3
261                   Select  the  style  of  delay  for CRs. This shall have the
262                   effect of setting CRDLY to CR0, CR1, CR2, or  CR3,  respec‐
263                   tively,  in  the  termios  c_oflag field, as defined in the
264                   Base Definitions volume of POSIX.1‐2017, Chapter  11,  Gen‐
265                   eral Terminal Interface.
266
267       nl0 nl1     Select  the  style  of  delay  for  NL. This shall have the
268                   effect of setting NLDLY to NL0 or NL1, respectively, in the
269                   termios  c_oflag  field, as defined in the Base Definitions
270                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
271                   face.
272
273       tab0 tab1 tab2 tab3
274                   Select  the  style of delay for horizontal tabs. This shall
275                   have the effect of setting TABDLY to TAB0, TAB1,  TAB2,  or
276                   TAB3,  respectively,  in  the  termios  c_oflag  field,  as
277                   defined in the Base  Definitions  volume  of  POSIX.1‐2017,
278                   Chapter 11, General Terminal Interface.  Note that TAB3 has
279                   the effect of expanding <tab> characters to <space> charac‐
280                   ters.
281
282       tabs (-tabs)
283                   Synonym for tab0 (tab3).
284
285       bs0 bs1     Select  the style of delay for <backspace> characters. This
286                   shall have the effect of  setting  BSDLY  to  BS0  or  BS1,
287                   respectively,  in  the termios c_oflag field, as defined in
288                   the Base Definitions volume of  POSIX.1‐2017,  Chapter  11,
289                   General Terminal Interface.
290
291       ff0 ff1     Select  the style of delay for <form-feed> characters. This
292                   shall have the effect of  setting  FFDLY  to  FF0  or  FF1,
293                   respectively,  in  the termios c_oflag field, as defined in
294                   the Base Definitions volume of  POSIX.1‐2017,  Chapter  11,
295                   General Terminal Interface.
296
297       vt0 vt1     Select  the  style  of delay for <vertical-tab> characters.
298                   This shall have the effect of setting VTDLY to VT0 or  VT1,
299                   respectively,  in  the termios c_oflag field, as defined in
300                   the Base Definitions volume of  POSIX.1‐2017,  Chapter  11,
301                   General Terminal Interface.
302
303   Local Modes
304       isig (-isig)
305                   Enable  (disable)  the  checking  of characters against the
306                   special control characters INTR, QUIT, and SUSP. This shall
307                   have  the  effect  of  setting  (not  setting)  ISIG in the
308                   termios c_lflag field, as defined in the  Base  Definitions
309                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
310                   face.
311
312       icanon (-icanon)
313                   Enable (disable) canonical input (ERASE and  KILL  process‐
314                   ing).  This  shall have the effect of setting (not setting)
315                   ICANON in the termios c_lflag field, as defined in the Base
316                   Definitions  volume  of  POSIX.1‐2017,  Chapter 11, General
317                   Terminal Interface.
318
319       iexten (-iexten)
320                   Enable (disable) any implementation-defined special control
321                   characters  not currently controlled by icanon, isig, ixon,
322                   or ixoff.  This shall have the effect of setting (not  set‐
323                   ting)  IEXTEN  in  the termios c_lflag field, as defined in
324                   the Base Definitions volume of  POSIX.1‐2017,  Chapter  11,
325                   General Terminal Interface.
326
327       echo (-echo)
328                   Echo  back  (do  not echo back) every character typed. This
329                   shall have the effect of setting (not setting) ECHO in  the
330                   termios  c_lflag  field, as defined in the Base Definitions
331                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
332                   face.
333
334       echoe (-echoe)
335                   The  ERASE  character  visually erases (does not erase) the
336                   last character in the current line  from  the  display,  if
337                   possible.  This  shall have the effect of setting (not set‐
338                   ting) ECHOE in the termios c_lflag field, as defined in the
339                   Base  Definitions  volume of POSIX.1‐2017, Chapter 11, Gen‐
340                   eral Terminal Interface.
341
342       echok (-echok)
343                   Echo (do not echo) NL after KILL character. This shall have
344                   the  effect  of  setting (not setting) ECHOK in the termios
345                   c_lflag field, as defined in the Base Definitions volume of
346                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
347
348       echonl (-echonl)
349                   Echo (do not echo) NL, even if echo is disabled. This shall
350                   have the effect of setting  (not  setting)  ECHONL  in  the
351                   termios  c_lflag  field, as defined in the Base Definitions
352                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
353                   face.
354
355       noflsh (-noflsh)
356                   Disable  (enable)  flush after INTR, QUIT, SUSP. This shall
357                   have the effect of setting  (not  setting)  NOFLSH  in  the
358                   termios  c_lflag  field, as defined in the Base Definitions
359                   volume of POSIX.1‐2017, Chapter 11, General Terminal Inter‐
360                   face.
361
362       tostop (-tostop)
363                   Send  SIGTTOU  for  background  output. This shall have the
364                   effect of setting  (not  setting)  TOSTOP  in  the  termios
365                   c_lflag field, as defined in the Base Definitions volume of
366                   POSIX.1‐2017, Chapter 11, General Terminal Interface.
367
368   Special Control Character Assignments
369       <control>‐character string
370             Set <control>‐character to string.  If <control>‐character is one
371             of  the  character sequences in the first column of the following
372             table,  the  corresponding  the  Base   Definitions   volume   of
373             POSIX.1‐2017,  Chapter  11,  General  Terminal  Interface control
374             character from the second column shall be  recognized.  This  has
375             the  effect  of  setting the corresponding element of the termios
376             c_cc array (see the  Base  Definitions  volume  of  POSIX.1‐2017,
377             Chapter 13, Headers, <termios.h>).
378
379                          Table: Control Character Names in stty
380
381                  ┌──────────────────┬────────────────┬─────────────────┐
382Control Character c_cc Subscript Description   
383                  ├──────────────────┼────────────────┼─────────────────┤
384eof               │ VEOF           │ EOF character   │
385eol               │ VEOL           │ EOL character   │
386erase             │ VERASE         │ ERASE character │
387intr              │ VINTR          │ INTR character  │
388kill              │ VKILL          │ KILL character  │
389quit              │ VQUIT          │ QUIT character  │
390susp              │ VSUSP          │ SUSP character  │
391start             │ VSTART         │ START character │
392stop              │ VSTOP          │ STOP character  │
393                  └──────────────────┴────────────────┴─────────────────┘
394             If  string  is a single character, the control character shall be
395             set to that character. If string is  the  two-character  sequence
396             "^-"  or  the string undef, the control character shall be set to
397             _POSIX_VDISABLE  ,  if  it  is  in  effect  for  the  device;  if
398             _POSIX_VDISABLE  is  not  in  effect  for the device, it shall be
399             treated as an error. In the POSIX locale, if  string  is  a  two-
400             character  sequence  beginning  with  <circumflex> ('^'), and the
401             second character is one of those listed in the "^c" column of the
402             following table, the control character shall be set to the corre‐
403             sponding character value in the Value column of the table.
404
405                       Table: Circumflex Control Characters in stty
406
407                      ┌──────────────┬────────────────┬──────────────┐
408^c   Value   ^c   Value   ^c   Value 
409                      ├──────────────┼────────────────┼──────────────┤
410                      │a, A  <SOH>   │  l, L  <FF>    │  w, W  <ETB> │
411                      │b, B  <STX>   │  m, M  <CR>    │  x, X  <CAN> │
412                      │c, C  <ETX>   │  n, N  <SO>    │  y, Y  <EM>  │
413                      │d, D  <EOT>   │  o, O  <SI>    │  z, Z  <SUB> │
414                      │e, E  <ENQ>   │  p, P  <DLE>   │  [     <ESC> │
415                      │f, F  <ACK>   │  q, Q  <DC1>   │  \     <FS>  │
416                      │g, G  <BEL>   │  r, R  <DC2>   │  ]     <GS>  │
417                      │h, H  <BS>    │  s, S  <DC3>   │  ^     <RS>  │
418                      │i, I  <HT>    │  t, T  <DC4>   │  _     <US>  │
419                      │j, J  <LF>    │  u, U  <NAK>   │  ?     <DEL> │
420                      │k, K  <VT>    │  v, V  <SYN>   │              │
421                      └──────────────┴────────────────┴──────────────┘
422       min number
423             Set the value of MIN to number.  MIN  is  used  in  non-canonical
424             mode input processing (icanon).
425
426       time number
427             Set  the  value of TIME to number.  TIME is used in non-canonical
428             mode input processing (icanon).
429
430   Combination Modes
431       saved settings
432             Set the current terminal characteristics to  the  saved  settings
433             produced by the -g option.
434
435       evenp or parity
436             Enable parenb and cs7; disable parodd.
437
438       oddp
439             Enable parenb, cs7, and parodd.
440
441       -parity, -evenp, or -oddp
442             Disable parenb, and set cs8.
443
444       raw (-raw or cooked)
445             Enable  (disable) raw input and output. Raw mode shall be equiva‐
446             lent to setting:
447
448
449                 stty cs8 erase ^- kill ^- intr ^- \
450                     quit ^- eof ^- eol ^- -post -inpck
451
452       nl (-nl)
453             Disable (enable) icrnl.  In addition, -nl unsets inlcr and igncr.
454
455       ek    Reset ERASE and KILL characters back to system defaults.
456
457       sane
458             Reset all modes to some reasonable, unspecified, values.
459

STDIN

461       Although no input is read from standard input, standard input shall  be
462       used  to  get  the  current terminal I/O characteristics and to set new
463       terminal I/O characteristics.
464

INPUT FILES

466       None.
467

ENVIRONMENT VARIABLES

469       The following environment variables shall affect the execution of stty:
470
471       LANG      Provide a default value for  the  internationalization  vari‐
472                 ables  that are unset or null. (See the Base Definitions vol‐
473                 ume of POSIX.1‐2017, Section 8.2, Internationalization  Vari‐
474                 ables  for  the  precedence of internationalization variables
475                 used to determine the values of locale categories.)
476
477       LC_ALL    If set to a non-empty string value, override  the  values  of
478                 all the other internationalization variables.
479
480       LC_CTYPE  This variable determines the locale for the interpretation of
481                 sequences of bytes of text data as characters  (for  example,
482                 single-byte as opposed to multi-byte characters in arguments)
483                 and which characters are in the class print.
484
485       LC_MESSAGES
486                 Determine the locale that should be used to affect the format
487                 and  contents  of  diagnostic  messages  written  to standard
488                 error.
489
490       NLSPATH   Determine the location of message catalogs for the processing
491                 of LC_MESSAGES.
492

ASYNCHRONOUS EVENTS

494       Default.
495

STDOUT

497       If operands are specified, no output shall be produced.
498
499       If  the -g option is specified, stty shall write to standard output the
500       current settings in a form that can be used  as  arguments  to  another
501       instance of stty on the same system.
502
503       If  the  -a option is specified, all of the information as described in
504       the OPERANDS section shall be written to standard output. Unless other‐
505       wise  specified, this information shall be written as <space>-separated
506       tokens in an unspecified format, on one or more lines, with an unspeci‐
507       fied number of tokens per line. Additional information may be written.
508
509       If  no  options or operands are specified, an unspecified subset of the
510       information written for the -a option shall be written.
511
512       If speed information is written as part of the default  output,  or  if
513       the  -a  option is specified and if the terminal input speed and output
514       speed are the same, the speed information shall be written as follows:
515
516
517           "speed %d baud;", <speed>
518
519       Otherwise, speeds shall be written as:
520
521
522           "ispeed %d baud; ospeed %d baud;", <ispeed>, <ospeed>
523
524       In locales other than the POSIX locale, the word baud may be changed to
525       something more appropriate in those locales.
526
527       If  control characters are written as part of the default output, or if
528       the -a option is specified, control characters shall be written as:
529
530
531           "%s = %s;", <control-character name>, <value>
532
533       where <value> is either the character, or some visual representation of
534       the  character if it is non-printable, or the string undef if the char‐
535       acter is disabled.
536

STDERR

538       The standard error shall be used only for diagnostic messages.
539

OUTPUT FILES

541       None.
542

EXTENDED DESCRIPTION

544       None.
545

EXIT STATUS

547       The following exit values shall be returned:
548
549        0    The terminal options were read or set successfully.
550
551       >0    An error occurred.
552

CONSEQUENCES OF ERRORS

554       Default.
555
556       The following sections are informative.
557

APPLICATION USAGE

559       The -g flag is designed to facilitate the saving and restoring of  ter‐
560       minal state from the shell level. For example, a program may:
561
562
563           saveterm="$(stty -g)"       # save terminal state
564           stty (new settings)         # set new state
565           ...                         # ...
566           stty $saveterm              # restore terminal state
567
568       Since the format is unspecified, the saved value is not portable across
569       systems.
570
571       Since the -a format is so loosely  specified,  scripts  that  save  and
572       restore terminal settings should use the -g option.
573

EXAMPLES

575       None.
576

RATIONALE

578       The  original  stty  description  was  taken directly from System V and
579       reflected the System V terminal driver termio.  It has been modified to
580       correspond to the terminal driver termios.
581
582       Output  modes are specified only for XSI-conformant systems. All imple‐
583       mentations are expected to provide stty operands corresponding  to  all
584       of the output modes they support.
585
586       The  stty utility is primarily used to tailor the user interface of the
587       terminal, such as selecting the preferred ERASE and KILL characters. As
588       an  application  programming  utility,  stty  can  be used within shell
589       scripts to alter the terminal settings for the duration of the script.
590
591       The termios section states that individual disabling of control charac‐
592       ters  is  possible through the option _POSIX_VDISABLE.  If enabled, two
593       conventions currently exist for specifying this: System  V  uses  "^-",
594       and  BSD  uses  undef.   Both  are  accepted  by stty in this volume of
595       POSIX.1‐2017. The other BSD convention of  using  the  letter  'u'  was
596       rejected  because  it conflicts with the actual letter 'u', which is an
597       acceptable value for a control character.
598
599       Early proposals did not specify the mapping of "^c" to control  charac‐
600       ters  because  the  control  characters were not specified in the POSIX
601       locale character set description file requirements. The control charac‐
602       ter   set   is   now  specified  in  the  Base  Definitions  volume  of
603       POSIX.1‐2017, Chapter 3, Definitions,  so  the  historical  mapping  is
604       specified.  Note that although the mapping corresponds to control-char‐
605       acter key assignments on many terminals that use  the  ISO/IEC 646:1991
606       standard  (or ASCII) character encodings, the mapping specified here is
607       to the control characters, not their keyboard encodings.
608
609       Since termios supports separate speeds for input and  output,  two  new
610       options were added to specify each distinctly.
611
612       Some  historical implementations use standard input to get and set ter‐
613       minal characteristics; others use standard output. Since input  from  a
614       login  TTY  is usually restricted to the owner while output to a TTY is
615       frequently open to anyone, using standard input provides fewer  chances
616       of  accidentally  (or  maliciously)  altering  the terminal settings of
617       other users. Using standard input also allows stty -a and stty -g  out‐
618       put  to be redirected for later use. Therefore, usage of standard input
619       is required by this volume of POSIX.1‐2017.
620

FUTURE DIRECTIONS

622       None.
623

SEE ALSO

625       Chapter 2, Shell Command Language
626
627       The Base Definitions volume of  POSIX.1‐2017,  Chapter  8,  Environment
628       Variables,  Chapter 11, General Terminal Interface, Section 12.2, Util‐
629       ity Syntax Guidelines, <termios.h>
630
632       Portions of this text are reprinted and reproduced in  electronic  form
633       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
634       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
635       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
636       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
637       event of any discrepancy between this version and the original IEEE and
638       The Open Group Standard, the original IEEE and The Open Group  Standard
639       is  the  referee document. The original Standard can be obtained online
640       at http://www.opengroup.org/unix/online.html .
641
642       Any typographical or formatting errors that appear  in  this  page  are
643       most likely to have been introduced during the conversion of the source
644       files to man page format. To report such errors,  see  https://www.ker
645       nel.org/doc/man-pages/reporting_bugs.html .
646
647
648
649IEEE/The Open Group                  2017                             STTY(1P)
Impressum