1stty(1)                          User Commands                         stty(1)
2
3
4

NAME

6       stty - set the options for a terminal
7

SYNOPSIS

9       /usr/bin/stty [-a] [-g]
10
11
12       /usr/bin/stty [modes]
13
14
15       /usr/xpg4/bin/stty [-a | -g]
16
17
18       /usr/xpg4/bin/stty [modes]
19
20
21       /usr/xpg6/bin/stty [-a | -g]
22
23
24       /usr/xpg6/bin/stty [modes]
25
26

DESCRIPTION

28       The  stty utility sets certain terminal I/O options for the device that
29       is the current standard input. Without arguments, stty reports the set‐
30       tings of certain options.
31
32
33       In  this  report,  if  a character is preceded by a caret (^), then the
34       value of that option is the corresponding control character (for  exam‐
35       ple,  ^h is CTRL-h. In this case, recall that CTRL-h is the same as the
36       BACKSPACE key). The sequence ^@ means that an option has a null value.
37
38
39       See termio(7I) for detailed information about  the  modes  listed  from
40       Control  Modes  through Local Modes. For detailed information about the
41       modes listed under Hardware Flow Control Modes  and  Clock  Modes,  see
42       termiox(7I).
43
44
45       Operands  described  in  the  Combination Modes section are implemented
46       using options in the earlier sections. Notice that many combinations of
47       options  make  no  sense, but no sanity checking is performed. Hardware
48       flow control and clock modes options might  not  be  supported  by  all
49       hardware interfaces.
50

OPTIONS

52       The following options are supported:
53
54       -a    Writes to standard output all of the option settings for the ter‐
55             minal.
56
57
58       -g    Reports current settings in a form that can be used as  an  argu‐
59             ment  to  another  stty command. Emits termios-type output if the
60             underlying driver supports it. Otherwise,  it  emits  termio-type
61             output.
62
63

OPERANDS

65       The following mode operands are supported:
66
67   Control Modes
68       parenb(-parenb)         Enable  (disable)  parity generation and detec‐
69                               tion.
70
71
72       parext(-parext)         Enable (disable) extended parity generation and
73                               detection for mark and space parity.
74
75
76       parodd(-parodd)         Select  odd (even) parity, or mark (space) par‐
77                               ity if parext is enabled.
78
79
80       cs5 cs6 cs7 cs8         Select character size (see termio(7I)).
81
82
83       0                       Hang up line immediately.
84
85
86       hupcl (-hupcl)          Hang up (do not hang  up)  connection  on  last
87                               close.
88
89
90       hup (-hup)              Same as hupcl(-hupcl).
91
92
93       cstopb (-cstopb)        Use two (one) stop bits per character.
94
95
96       cread (-cread)          Enable (disable) the receiver.
97
98
99       crtscts (-crtscts)      Enable  output hardware flow control. Raise the
100                               RTS (Request to Send) modem control line.  Sus‐
101                               pends output until the CTS (Clear to Send) line
102                               is raised.
103
104
105       crtsxoff (-crtsxoff)    Enable input hardware flow control.  Raise  the
106                               RTS  (Request  to  Send)  modem control line to
107                               receive data. Suspends input when RTS is low.
108
109
110       clocal (-clocal)        Assume a line without (with) modem control.
111
112
113       defeucw                 Set the widths of multibyte characters  to  the
114                               values  defined in the current locale specified
115                               by LC_CTYPE. Internally, width is expressed  in
116                               terms  of  bytes  per  character, and screen or
117                               display columns per character.
118
119
120       110 300 600 1200 1800
121       2400 4800 9600 19200
122       38400 357600 76800 115200
123       153600 230400 307200 460800
124
125           Set terminal baud rate to  the  number  given,  if  possible.  (All
126           speeds are not supported by all hardware interfaces.)
127
128
129       ispeed 0 110 300 600 1200
130       1800 2400 4800 9600 19200
131       38400 57600 76800 115200
132       153600 230400 307200 460800
133
134           Set terminal input baud rate to the number given, if possible. (Not
135           all hardware supports split baud rates.) If the input baud rate  is
136           set to 0, the input baud rate is specified by the value of the out‐
137           put baud rate.
138
139
140       ospeed 0 110 300 600 1200
141       1800 2400 4800 9600 19200
142       38400 57600 76800 115200
143       153600 230400 307200 460800
144
145           Set terminal output baud rate to the  number  given,  if  possible.
146           (Not  all  hardware  supports split baud rates.) If the output baud
147           rate is set to 0, the line is hung up immediately.
148
149
150   Input Modes
151       ignbrk (-ignbrk)      Ignore (do not ignore) break on input.
152
153
154       brkint (-brkint)      Signal (do not signal) INTR on break.
155
156
157       ignpar (-ignpar)      Ignore (do not ignore) parity errors.
158
159
160       parmrk (-parmrk)      Mark   (do   not   mark)   parity   errors   (see
161                             termio(7I)).
162
163
164       inpck (-inpck)        Enable (disable) input parity checking.
165
166
167       istrip (-istrip)      Strip  (do  not  strip) input characters to seven
168                             bits.
169
170
171       inlcr (-inlcr)        Map (do not map) NL to CR on input.
172
173
174       igncr (-igncr)        Ignore (do not ignore) CR on input.
175
176
177       icrnl (-icrnl)        Map (do not map) CR to NL on input.
178
179
180       iuclc (-iuclc)        Map (do not map) upper-case alphabetics to  lower
181                             case on input.
182
183
184       ixon (-ixon)          Enable  (disable) START/STOP output control. Out‐
185                             put is stopped by sending STOP control  character
186                             and  started by sending the START control charac‐
187                             ter.
188
189
190       ixany (-ixany)        Allow any character (only DC1) to restart output.
191
192
193       ixoff (-ixoff)        Request  that  the   system   send   (not   send)
194                             START/STOP  characters  when  the  input queue is
195                             nearly empty/full.
196
197
198       imaxbel (-imaxbel)    Echo (do not echo) BEL when the input line is too
199                             long.  If imaxbel is set, the ASCII BEL character
200                             (07 hex) is echoed if the input stream overflows.
201                             Further  input  is   not  stored,  but  any input
202                             already present is not disturbed. If -imaxbel  is
203                             set,  no  BEL character is echoed, and all unread
204                             input present in the input queue is discarded  if
205                             the input stream overflows.
206
207
208   Output Modes
209       opost (-opost)         Post-process output (do not post-process output;
210                              ignore all other output modes).
211
212
213       olcuc (-olcuc)         Map (do not map) lower-case alphabetics to upper
214                              case on output.
215
216
217       onlcr (-onlcr)         Map (do not map) NL to CR-NL on output.
218
219
220       ocrnl (-ocrnl)         Map (do not map) CR to NL on output.
221
222
223       onocr (-onocr)         Do not (do) output CRs at column zero.
224
225
226       onlret (-onlret)       On  the  terminal NL performs (does not perform)
227                              the CR function.
228
229
230       ofill (-ofill)         Use fill characters (use timing) for delays.
231
232
233       ofdel (-ofdel)         Fill characters are DELs (NULs).
234
235
236       cr0 cr1 cr2 cr3        Select style of delay for carriage returns  (see
237                              termio(7I)).
238
239
240       nl0 nl1                Select   style  of  delay  for  line-feeds  (see
241                              termio(7I)).
242
243
244       tab0 tab1 tab2 tab3    Select style of delay for horizontal  tabs  (see
245                              termio(7I)).
246
247
248       bs0 bs1                Select   style  of  delay  for  backspaces  (see
249                              termio(7I)).
250
251
252       ff0 ff1                Select  style  of  delay  for  form-feeds   (see
253                              termio(7I)).
254
255
256       vt0 vt1                Select  style  of  delay  for vertical tabs (see
257                              termio(7I)).
258
259
260   Local Modes
261       isig(-isig)           Enable  (disable)  the  checking  of   characters
262                             against  the  special  control  characters  INTR,
263                             QUIT, SWTCH, and SUSP. For information on  SWTCH,
264                             see NOTES.
265
266
267       icanon (-icanon)      Enable  (disable) canonical input (ERASE and KILL
268                             processing). Does not set MIN or TIME.
269
270
271       xcase (-xcase)        Canonical (unprocessed) upper/lower-case  presen‐
272                             tation.
273
274
275       echo (-echo)          Echo  back  (do  not  echo  back) every character
276                             typed.
277
278
279       echoe (-echoe)        Echo  (do  not  echo)  ERASE   character   as   a
280                             backspace-space-backspace   string.   This   mode
281                             erases the ERASEed character on many  CRT  termi‐
282                             nals;  however,  it does not keep track of column
283                             position and, as a result, it might be  confusing
284                             for escaped characters, tabs, and backspaces.
285
286
287       echok(-echok)         Echo (do not echo) NL after KILL character.
288
289
290       lfkc (-lfkc)          The same as echok(-echok); obsolete.
291
292
293       echonl (-echonl)      Echo (do not echo) NL.
294
295
296       noflsh (-noflsh)      Disable (enable) flush after INTR, QUIT, or SUSP.
297
298
299       stwrap (-stwrap)      Disable  (enable) truncation of lines longer than
300                             79 characters on a synchronous line.
301
302
303       tostop (-tostop)      Send (do not send) SIGTTOU when  background  pro‐
304                             cesses write to the terminal.
305
306
307       echoctl (-echoctl)    Echo  (do  not echo) control characters as ^char,
308                             delete as ^?.
309
310
311       echoprt (-echoprt)    Echo (do not echo) erase character  as  character
312                             is ``erased''.
313
314
315       echoke (-echoke)      BS-SP-BS  erase  (do  not  BS-SP-BS erase) entire
316                             line on line kill.
317
318
319       flusho (-flusho)      Output is (is not) being flushed.
320
321
322       pendin (-pendin)      Retype (do not retype) pending input at next read
323                             or input character.
324
325
326       iexten (-iexten)      Enable  (disable)  special control characters not
327                             currently controlled by icanon,  isig,  ixon,  or
328                             ixoff:  VEOL, VSWTCH, VREPRINT, VDISCARD, VDSUSP,
329                             VWERASE, and VLNEXT.
330
331
332       stflush (-stflush)    Enable (disable)  flush  on  a  synchronous  line
333                             after every write(2).
334
335
336       stappl (-stappl)      Use  application  mode  (use line mode) on a syn‐
337                             chronous line.
338
339
340   Hardware Flow Control Modes
341       rtsxoff (-rtsxoff)    Enable (disable) RTS  hardware  flow  control  on
342                             input.
343
344
345       ctsxon (-ctsxon)      Enable  (disable)  CTS  hardware  flow control on
346                             output.
347
348
349       dtrxoff (-dtrxoff)    Enable (disable) DTR  hardware  flow  control  on
350                             input.
351
352
353       cdxon (-cdxon)        Enable (disable) CD hardware flow control on out‐
354                             put.
355
356
357       isxoff (-isxoff)      Enable (disable) isochronous hardware  flow  con‐
358                             trol on input.
359
360
361   Clock Modes
362       xcibrg       Get transmit clock from internal baud rate generator.
363
364
365       xctset       Get  the  transmit  clock  from transmitter signal element
366                    timing  (DCE  source)  lead,  CCITT  V.24   circuit   114,
367                    EIA-232-D pin 15.
368
369
370       xcrset       Get  transmit  clock  from  receiver signal element timing
371                    (DCE source) lead, CCITT V.24 circuit 115,  EIA-232-D  pin
372                    17.
373
374
375       rcibrg       Get receive clock from internal baud rate generator.
376
377
378       rctset       Get  receive  clock from transmitter signal element timing
379                    (DCE source) lead, CCITT V.24 circuit 114,  EIA-232-D  pin
380                    15.
381
382
383       rcrset       Get receive clock from receiver signal element timing (DCE
384                    source) lead, CCITT V.24 circuit 115, EIA-232-D pin 17.
385
386
387       tsetcoff     Transmitter signal element timing clock not provided.
388
389
390       tsetcrbrg    Output receive baud rate generator on  transmitter  signal
391                    element  timing (DTE source) lead, CCITT V.24 circuit 113,
392                    EIA-232-D pin 24.
393
394
395       tsetctbrg    Output transmit baud rate generator on transmitter  signal
396                    element  timing (DTE source) lead, CCITT V.24 circuit 113,
397                    EIA-232-D pin 24.
398
399
400       tsetctset    Output transmitter signal element timing (DCE  source)  on
401                    transmitter signal element timing (DTE source) lead, CCITT
402                    V.24 circuit 113, EIA-232-D pin 24.
403
404
405       tsetcrset    Output receiver signal  element  timing  (DCE  source)  on
406                    transmitter signal element timing (DTE source) lead, CCITT
407                    V.24 circuit 113, EIA-232-D pin 24.
408
409
410       rsetcoff     Receiver signal element timing clock not provided.
411
412
413       rsetcrbrg    Output receive baud rate generator on receiver signal ele‐
414                    ment  timing (DTE source) lead, CCITT V.24 circuit 128, no
415                    EIA-232-D pin.
416
417
418       rsetctbrg    Output transmit baud rate  generator  on  receiver  signal
419                    element  timing (DTE source) lead, CCITT V.24 circuit 128,
420                    no EIA-232-D pin.
421
422
423       rsetctset    Output transmitter signal element timing (DCE  source)  on
424                    receiver  signal  element  timing (DTE source) lead, CCITT
425                    V.24 circuit 128, no EIA-232-D pin.
426
427
428       rsetcrset    Output receiver signal  element  timing  (DCE  source)  on
429                    receiver  signal  element  timing (DTE source) lead, CCITT
430                    V.24 circuit 128, no EIA-232-D pin.
431
432
433   Control Assignments
434       control-character c
435
436           Set control-character to c, where:
437
438           control-character    is  ctab,  discard,  dsusp,  eof,  eol,  eol2,
439                                erase,   intr,  kill,  lnext,  quit,  reprint,
440                                start, stop, susp, swtch, or werase  (ctab  is
441                                used with -stappl, see termio(7I)). For infor‐
442                                mation on swtch, see NOTES.
443
444
445           c                    If c is a single character, the control  char‐
446                                acter is set to that character.
447
448                                In  the  POSIX  locale,  if c is preceded by a
449                                caret (^) indicating an escape from the  shell
450                                and is one of those listed in the ^c column of
451                                the following table, then its value  used  (in
452                                the Value column) is the corresponding control
453                                character (for example, ``^d'' is  a  CTRL-d).
454                                ``^?''  is  interpreted  as  DEL and ``^−'' is
455                                interpreted as undefined.
456
457
458
459
460
461
462       ┌───────────────────────────────────────────────────────────────────────┐
463^c         Value        ^c         Value         ^c         Value   
464a, A        <SOH>       l, L        <FF>         w, W        <ETB>     │
465b, B        <STX>       m, M        <CR>         x, X        <CAN>     │
466c, C        <ETX>       n, N        <SO>         y, Y        <EM>      │
467d, D        <EOT>       o, O        <SI>         z, Z        <SUB>     │
468e, E        <ENQ>       p, P        <DLE>        [           <ESC>     │
469f, F        <ACK>       q, Q        <DC1>        \           <FS>      │
470g, G        <BEL>       r, R        <DC2>        ]           <GS>      │
471h, H        <BS>        s, S        <DC3>        ^           <RS>      │
472i, I        <HT>        t, T        <DC4>        _           <US>      │
473j, J        <LF>        u, U        <NAK>        ?           <DEL>     │
474k, K        <VT>        v, V        <SYN>                              │
475       └───────────────────────────────────────────────────────────────────────┘
476
477       min number     Set the value of min or time to number. MIN and TIME are
478       time number    used in Non-Canonical mode input processing (-icanon).
479
480
481       line i         Set line discipline to i ( 0< i <127).
482
483
484   Combination Modes
485       saved settings          Set the current terminal characteristics to the
486                               saved settings produced by the -g option.
487
488
489       evenp or parity         Enable parenb and cs7, or disable parodd.
490
491
492       oddp                    Enable parenb, cs7, and parodd.
493
494
495       spacep                  Enable parenb, cs7, and parext.
496
497
498       markp                   Enable parenb, cs7, parodd, and parext.
499
500
501       -parity, or -evenp      Disable parenb, and set cs8.
502
503
504       -oddp                   Disable parenb and parodd, and set cs8.
505
506
507       -spacep                 Disable parenb and parext, and set cs8.
508
509
510       -markp                  Disable parenb, parodd,  and  parext,  and  set
511                               cs8.
512
513
514       raw (-raw or cooked)    Enable (disable) raw input and output. Raw mode
515                               is equivalent to setting:
516
517                                 stty cs8 -icanon min 1 time 0 -isig -xcase \
518                                     -inpck -opost
519
520
521
522   /usr/bin/stty, /usr/xpg6/bin/stty
523       nl (-nl)    Unset (set) icrnl, onlcr. In  addition  -nl  unsets  inlcr,
524                   igncr, ocrnl, and onlret.
525
526
527   /usr/xpg4/bin/stty
528       nl (-nl)                Set  (unset)  icrnl.  In  addition,  -nl unsets
529                               inlcr,  igncr,  ocrnl,  and  onlret;  -nl  sets
530                               onlcr, and nl unsets onlcr.
531
532
533       lcase (-lcase)          Set (unset) xcase, iuclc, and olcuc.
534
535
536       LCASE (-LCASE)          Same as lcase (-lcase).
537
538
539       tabs (-tabs or tab3)    Preserve (expand to spaces) tabs when printing.
540
541
542       ek                      Reset  ERASE and KILL characters back to normal
543                               DEL and CTRL-u, respectively.
544
545
546       sane                    Reset all modes to some reasonable values.
547
548
549       term                    Set all modes suitable for  the  terminal  type
550                               term,  where term is one of tty33, tty37, vt05,
551                               tn300, ti700, or tek.
552
553
554       async                   Set normal  asynchronous  communications  where
555                               clock settings are xcibrg, rcibrg, tsetcoff and
556                               rsetcoff.
557
558
559   Window Size
560       rows n       Set window size to n rows.
561
562
563       columns n    Set window size to n columns.
564
565
566       cols n       Set window size to n columns. cols is  a  shorthand  alias
567                    for columns.
568
569
570       ypixels n    Set vertical window size to n pixels.
571
572
573       xpixels n    Set horizontal window size to n pixels.
574
575

USAGE

577       The  -g flag is designed to facilitate the saving and restoring of ter‐
578       minal state from the shell level. For example, a program can:
579
580         saveterm="$(stty -g)"      # save terminal state
581         stty (new settings)        # set new state
582         ...                        # ...
583         stty $saveterm             # restore terminal state
584
585
586
587
588       Since the -a format is so loosely  specified,  scripts  that  save  and
589       restore terminal settings should use the -g option.
590

ENVIRONMENT VARIABLES

592       See  environ(5) for descriptions of the following environment variables
593       that affect the execution of stty: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
594       and NLSPATH.
595

EXIT STATUS

597       The following exit values are returned:
598
599       0     Successful completion.
600
601
602       >0    An error occurred.
603
604

ATTRIBUTES

606       See attributes(5) for descriptions of the following attributes:
607
608   /usr/bin/stty
609       ┌─────────────────────────────┬─────────────────────────────┐
610       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
611       ├─────────────────────────────┼─────────────────────────────┤
612       │Availability                 │SUNWcsu                      │
613       └─────────────────────────────┴─────────────────────────────┘
614
615   /usr/xpg4/bin/stty
616       ┌─────────────────────────────┬─────────────────────────────┐
617       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
618       ├─────────────────────────────┼─────────────────────────────┤
619       │Availability                 │SUNWxcu4                     │
620       ├─────────────────────────────┼─────────────────────────────┤
621       │Interface Stability          │Committed                    │
622       ├─────────────────────────────┼─────────────────────────────┤
623       │Standard                     │See standards(5).            │
624       └─────────────────────────────┴─────────────────────────────┘
625
626   /usr/xpg6/bin/stty
627       ┌─────────────────────────────┬─────────────────────────────┐
628       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
629       ├─────────────────────────────┼─────────────────────────────┤
630       │Availability                 │SUNWxcu6                     │
631       ├─────────────────────────────┼─────────────────────────────┤
632       │Interface Stability          │Committed                    │
633       ├─────────────────────────────┼─────────────────────────────┤
634       │Standard                     │See standards(5).            │
635       └─────────────────────────────┴─────────────────────────────┘
636

SEE ALSO

638       tabs(1),  ioctl(2),  write(2), getwidth(3C), attributes(5), environ(5),
639       standards(5), ldterm(7M), termio(7I), termiox(7I)
640

NOTES

642       Solaris does not support any of the actions implied by swtch, which was
643       used  by the sxt driver on System V release 4. Solaris allows the swtch
644       value to be set, and prints it out if set, but it does not perform  the
645       swtch action.
646
647
648       The job switch functionality on Solaris is actually handled by job con‐
649       trol. susp is the correct setting for this.
650
651
652
653SunOS 5.11                        20 May 2009                          stty(1)
Impressum