1 .\" $NetBSD: stty.1,v 1.37 2009/12/14 02:34:52 dholland Exp $
3 .\" Copyright (c) 1990, 1993, 1994
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)stty.1 8.5 (Berkeley) 6/1/94
40 .Nd set the options for a terminal device interface
43 .Op Fl a | Fl e | Fl g
49 utility sets or reports on terminal
50 characteristics for the device that is its standard input.
51 If no options or operands are specified, it reports the settings of a subset
52 of characteristics as well as additional ones if they differ from their
55 the terminal state according to the specified arguments.
56 Some combinations of arguments are mutually
57 exclusive on some terminal types.
59 The following options are available:
62 Display all the current settings for the terminal to standard output
66 Display all the current settings for the terminal to standard output
69 ``all'' and ``everything'' formats.
71 Open and use the terminal named by
73 rather than using standard input.
74 The file is opened using the
79 set or display settings on a terminal that might otherwise
82 Display all the current settings for the terminal to standard output
83 in a form that may be used as an argument to a subsequent invocation of
85 to restore the current terminal state as per
89 The following arguments are available to set the terminal
92 Control mode flags affect hardware characteristics associated with the
94 This corresponds to the c_cflag in the termios structure.
96 .It Cm parenb Pq Fl parenb
97 Enable (disable) parity generation
99 .It Cm parodd Pq Fl parodd
100 Select odd (even) parity.
101 .It Cm cs5 cs6 cs7 cs8
102 Select character size, if possible.
104 Set terminal baud rate to the
105 number given, if possible.
107 baud rate is set to zero, modem
110 .It Cm ispeed Ar number
111 Set terminal input baud rate to the
112 number given, if possible.
114 input baud rate is set to zero, the
115 input baud rate is set to the
116 value of the output baud
118 .It Cm ospeed Ar number
119 Set terminal output baud rate to
120 the number given, if possible.
122 the output baud rate is set to
123 zero, modem control is
125 .It Cm speed Ar number
132 .It Cm hupcl Pq Fl hupcl
133 Stop asserting modem control
134 (do not stop asserting modem control) on last close.
138 .It Cm cstopb Pq Fl cstopb
139 Use two (one) stop bits per character.
140 .It Cm cread Pq Fl cread
141 Enable (disable) the receiver.
142 .It Cm clocal Pq Fl clocal
143 Assume a line without (with) modem
145 .It Cm crtscts Pq Fl crtscts
146 Enable RTS/CTS flow control.
147 .It Cm cdtrcts Pq Fl cdtrcts
148 Enable DTR/CTS flow control (if supported).
151 This corresponds to the c_iflag in the termios structure.
153 .It Cm ignbrk Pq Fl ignbrk
154 Ignore (do not ignore) break on
156 .It Cm brkint Pq Fl brkint
157 Signal (do not signal)
161 .It Cm ignpar Pq Fl ignpar
162 Ignore (do not ignore) parity
164 .It Cm parmrk Pq Fl parmrk
165 Mark (do not mark) parity errors.
166 .It Cm inpck Pq Fl inpck
167 Enable (disable) input parity
169 .It Cm istrip Pq Fl istrip
170 Strip (do not strip) input characters
172 .It Cm inlcr Pq Fl inlcr
178 .It Cm igncr Pq Fl igncr
179 Ignore (do not ignore)
182 .It Cm icrnl Pq Fl icrnl
188 .It Cm ixon Pq Fl ixon
193 Output from the system is
194 stopped when the system receives
196 and started when the system
201 is set, any character restarts output.
202 .It Cm ixoff Pq Fl ixoff
203 Request that the system send (not
207 the input queue is nearly
209 .It Cm ixany Pq Fl ixany
210 Allow any character (allow only
213 .It Cm imaxbel Pq Fl imaxbel
214 The system imposes a limit of
216 (currently 255) characters in the input queue.
219 is set and the input queue limit has been reached,
220 subsequent input causes the system to send an ASCII BEL
221 character to the output queue (the terminal beeps at you).
225 is unset and the input queue is full, the next input character causes
226 the entire input and output queues to be discarded.
229 This corresponds to the c_oflag of the termios structure.
231 .It Cm opost Pq Fl opost
232 Post-process output (do not
233 post-process output; ignore all other
235 .It Cm onlcr Pq Fl onlcr
241 .It Cm ocrnl Pq Fl ocrnl
247 .It Cm oxtabs Pq Fl oxtabs
248 Expand (do not expand) tabs to spaces on output.
249 .It Cm onocr Pq Fl onocr
250 Do not (do) output CRs at column zero.
251 .It Cm onlret Pq Fl onlret
252 On the terminal NL performs (does not perform) the CR function.
255 Local mode flags (lflags) affect various and sundry characteristics of terminal
257 Historically the term "local" pertained to new job control features
258 implemented by Jim Kulp on a
262 Later the driver ran on the first
264 at Evans Hall, UC Berkeley, where the job control details
265 were greatly modified but the structure definitions and names
266 remained essentially unchanged.
267 The second interpretation of the 'l' in lflag
268 is ``line discipline flag'' which corresponds to the
274 .It Cm isig Pq Fl isig
275 Enable (disable) the checking of
276 characters against the special control
281 .It Cm icanon Pq Fl icanon
282 Enable (disable) canonical input
287 .It Cm iexten Pq Fl iexten
288 Enable (disable) any implementation
289 defined special control characters
290 not currently controlled by icanon,
292 .It Cm echo Pq Fl echo
293 Echo back (do not echo back) every
295 .It Cm echoe Pq Fl echoe
298 character shall (shall
299 not) visually erase the last character
300 in the current line from the
301 display, if possible.
302 .It Cm echok Pq Fl echok
308 .It Cm echoke Pq Fl echoke
311 character shall (shall
313 the current line from the
314 display, if possible.
315 .It Cm echonl Pq Fl echonl
320 .It Cm echoctl Pq Fl echoctl
323 is set, echo control characters as ^X.
324 Otherwise control characters echo as themselves.
325 .It Cm echoprt Pq Fl echoprt
326 For printing terminals.
327 If set, echo erased characters backwards within ``\\''
329 Otherwise, disable this feature.
330 .It Cm noflsh Pq Fl noflsh
331 Disable (enable) flush after
332 .Dv INTR , QUIT , SUSP .
333 .It Cm tostop Pq Fl tostop
336 for background output.
337 This causes background jobs to stop if they attempt terminal output.
338 .It Cm altwerase Pq Fl altwerase
339 Use (do not use) an alternative word erase algorithm when processing
342 This alternative algorithm considers sequences of
343 alphanumeric/underscores as words.
344 It also skips the first preceding character in its classification
345 (as a convenience since the one preceding character could have been
346 erased with simply an
349 .It Cm mdmbuf Pq Fl mdmbuf
350 If set, flow control output based on condition of Carrier Detect.
351 Otherwise writes return an error if Carrier Detect is low (and Carrier
352 is not being ignored with the
355 .It Cm flusho Pq Fl flusho
356 Indicates output is (is not) being discarded.
357 .It Cm pendin Pq Fl pendin
358 Indicates input is (is not) pending after a switch from non-canonical
359 to canonical mode and will be re-input when a read becomes pending
360 or more input arrives.
362 .Ss Control Characters
364 .It Ar control-character Ar string
366 .Ar control-character
369 If string is a single character,
370 the control character is set to
373 two character sequence "^-" or the
374 string "undef" the control character
375 is disabled (i.e. set to
376 .Bro Dv _POSIX_VDISABLE Brc . )
378 Recognized control-characters:
379 .Bd -ragged -offset indent
380 .Bl -column character Subscript Description
381 .It control- Ta "" Ta ""
382 .It character Subscript Description
383 .It _________ _________ _______________
384 .It eof Ta Tn VEOF Ta EOF No character
385 .It eol Ta Tn VEOL Ta EOL No character
386 .It eol2 Ta Tn VEOL2 Ta EOL2 No character
387 .It erase Ta Tn VERASE Ta ERASE No character
388 .It werase Ta Tn VWERASE Ta WERASE No character
389 .It kill Ta Tn VKILL Ta KILL No character
390 .It reprint Ta Tn VREPRINT Ta REPRINT No character
391 .It intr Ta Tn VINTR Ta INTR No character
392 .It quit Ta Tn VQUIT Ta QUIT No character
393 .It susp Ta Tn VSUSP Ta SUSP No character
394 .It dsusp Ta Tn VDSUSP Ta DSUSP No character
395 .It start Ta Tn VSTART Ta START No character
396 .It stop Ta Tn VSTOP Ta STOP No character
397 .It lnext Ta Tn VLNEXT Ta LNEXT No character
398 .It status Ta Tn VSTATUS Ta STATUS No character
399 .It discard Ta Tn VDISCARD Ta DISCARD No character
403 .It Cm time Ar number
404 Set the value of min or time to
410 Non-Canonical mode input processing
413 .Ss Combination Modes
415 .It Ar saved settings
416 Set the current terminal characteristics to the saved settings
420 .It Cm evenp No or Cm parity
421 Enable parenb and cs7; disable parodd.
423 Enable parenb, cs7, and parodd.
424 .It Fl parity , evenp , oddp
425 Disable parenb, and set cs8.
426 .It Cm \&nl Pq Fl \&nl
427 Enable (disable) icrnl.
429 -nl unsets inlcr and igncr.
435 characters back to system defaults.
437 Resets all modes to reasonable values for interactive terminal use.
439 Sets all modes to random values, which are very likely
440 .Pq but not guaranteed
441 to be unreasonable for interactive terminal use.
443 Set the line discipline to the standard terminal line discipline
446 Set (disable) all modes suitable for a CRT display device.
447 .It Cm kerninfo Pq Fl kerninfo
448 Enable (disable) the system generated status line associated with
451 character (usually set to ^T).
452 The status line consists of the
453 system load average, the current command name, its process ID, the
454 event the process is waiting on (or the status of the process), the user
455 and system times, percent CPU, and current memory usage.
456 .It Cm columns Ar number
457 The terminal size is recorded as having
460 .It Cm cols Ar number
463 .It Cm rows Ar number
464 The terminal size is recorded as having
468 Set modes suitable for users of Digital Equipment Corporation systems (
473 characters are set to ^?, ^U, and ^C;
478 .It Cm extproc Pq Fl extproc
479 If set, this flag indicates that some amount of terminal processing is being
480 performed by either the terminal hardware or by the remote side connected
483 If set, change the modes of the terminal so that no input or output processing
485 If unset, change the modes of the terminal to some reasonable
486 state that performs input and output processing.
487 Note that since the terminal driver no longer has a single
489 bit, it is not possible to intuit what flags were set prior to setting
491 This means that unsetting
493 may not put back all the setting that were previously in effect.
494 To set the terminal into a raw state and then accurately restore it, the following
495 shell code is recommended:
496 .Bd -literal -offset indent
497 save_state=$(stty -g)
503 The size of the terminal is printed as two numbers on a single line,
504 first rows, then columns.
506 .Ss Compatibility Modes
507 These modes remain for compatibility with the previous version of
511 Reports all the terminal modes as with
513 except that the control characters are printed in a columnar format.
522 .Cm brkint , ixon , imaxbel , opost ,
534 .It Cm newcrt Pq Fl newcrt
540 .It Cm tandem Pq Fl tandem
543 .It Cm decctlq Pq Fl decctlq
546 .It Cm crterase Pq Fl crterase
549 .It Cm crtbs Pq Fl crtbs
552 .It Cm crtkill Pq Fl crtkill
555 .It Cm ctlecho Pq Fl ctlecho
558 .It Cm prterase Pq Fl prterase
561 .It Cm litout Pq Fl litout
564 .It Cm tabs Pq Fl tabs
568 Same as the control character
570 .It Cm flush Ar value
571 Same as the control character
573 .It Cm rprnt Ar value
574 Same as the control character
577 .Ss Control operations
578 These operations are not modes, but rather commands to be performed by
582 Performs a "start output" operation, as normally done by an
583 incoming START character when
587 Performs a "stop output" operation, as normally done by an
588 incoming STOP character when
595 utility exits with a value of 0 if successful, and \*[Gt]0 if an error occurs.
602 utility is expected to be
610 extensions to the standard, as are the operands mentioned in the control