1 .\" $NetBSD: stty.1,v 1.43 2016/08/14 23:29:43 sevan 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 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:
60 .Bl -tag -width XfXfileXX
62 Display all the current settings for the terminal to standard output
66 Display all the current settings for the terminal to standard output
74 Open and use the terminal named by
76 rather than using standard input.
77 The file is opened using the
82 set or display settings on a terminal that might otherwise
85 Display all the current settings for the terminal to standard output
86 in a form that may be used as an argument to a subsequent invocation of
88 to restore the current terminal state as per
92 The following arguments are available to set the terminal
95 Control mode flags affect hardware characteristics associated with the
97 This corresponds to the
103 .It Cm parenb Pq Fl parenb
104 Enable (disable) parity generation
106 .It Cm parodd Pq Fl parodd
107 Select odd (even) parity.
108 .It Cm cs5 cs6 cs7 cs8
109 Select character size, if possible.
111 Set terminal baud rate to
115 baud rate is set to zero, modem
118 .It Cm ispeed Ar number
119 Set terminal input baud rate to
123 input baud rate is set to zero, the
124 input baud rate is set to the
125 value of the output baud
127 .It Cm ospeed Ar number
128 Set terminal output baud rate to
132 the output baud rate is set to
133 zero, modem control is
135 .It Cm speed Ar number
142 .It Cm hupcl Pq Fl hupcl
143 Stop asserting modem control
144 (do not stop asserting modem control) on last close.
148 .It Cm cstopb Pq Fl cstopb
149 Use two (one) stop bits per character.
150 .It Cm cread Pq Fl cread
151 Enable (disable) the receiver.
152 .It Cm clocal Pq Fl clocal
153 Assume a line without (with) modem
155 .It Cm crtscts Pq Fl crtscts
156 Enable RTS/CTS flow control.
157 .It Cm cdtrcts Pq Fl cdtrcts
158 Enable DTR/CTS flow control (if supported).
161 This corresponds to the
167 .It Cm ignbrk Pq Fl ignbrk
168 Ignore (do not ignore) break on
170 .It Cm brkint Pq Fl brkint
171 Signal (do not signal)
175 .It Cm ignpar Pq Fl ignpar
176 Ignore (do not ignore) parity
178 .It Cm parmrk Pq Fl parmrk
179 Mark (do not mark) parity errors.
180 .It Cm inpck Pq Fl inpck
181 Enable (disable) input parity
183 .It Cm istrip Pq Fl istrip
184 Strip (do not strip) input characters
186 .It Cm inlcr Pq Fl inlcr
192 .It Cm igncr Pq Fl igncr
193 Ignore (do not ignore)
196 .It Cm icrnl Pq Fl icrnl
202 .It Cm ixon Pq Fl ixon
207 Output from the system is
208 stopped when the system receives
210 and started when the system
215 is set, any character restarts output.
216 .It Cm ixoff Pq Fl ixoff
217 Request that the system send (not
221 the input queue is nearly
223 .It Cm ixany Pq Fl ixany
224 Allow any character (allow only
227 .It Cm imaxbel Pq Fl imaxbel
228 The system imposes a limit of
230 (currently 255) characters in the input queue.
233 is set and the input queue limit has been reached,
234 subsequent input causes the system to send an ASCII BEL
235 character to the output queue (the terminal beeps at you).
239 is unset and the input queue is full, the next input character causes
240 the entire input and output queues to be discarded.
243 This corresponds to the
249 .It Cm opost Pq Fl opost
250 Post-process output (do not
251 post-process output; ignore all other
253 .It Cm onlcr Pq Fl onlcr
259 .It Cm ocrnl Pq Fl ocrnl
265 .It Cm oxtabs Pq Fl oxtabs
266 Expand (do not expand) tabs to spaces on output.
267 .It Cm onocr Pq Fl onocr
268 Do not (do) output CRs at column zero.
269 .It Cm onlret Pq Fl onlret
270 On the terminal NL performs (does not perform) the CR function.
273 Local mode flags (lflags) affect various and sundry characteristics of terminal
275 Historically the term "local" pertained to new job control features
276 implemented by Jim Kulp on a
280 Later the driver ran on the first
282 at Evans Hall, UC Berkeley, where the job control details
283 were greatly modified but the structure definitions and names
284 remained essentially unchanged.
285 The second interpretation of the
289 .Dq line discipline flag ,
290 which corresponds to the
296 .It Cm isig Pq Fl isig
297 Enable (disable) the checking of
298 characters against the special control
303 .It Cm icanon Pq Fl icanon
304 Enable (disable) canonical input
309 .It Cm iexten Pq Fl iexten
310 Enable (disable) any implementation
311 defined special control characters
312 not currently controlled by icanon,
314 .It Cm echo Pq Fl echo
315 Echo back (do not echo back) every
317 .It Cm echoe Pq Fl echoe
320 character shall (shall
321 not) visually erase the last character
322 in the current line from the
323 display, if possible.
324 .It Cm echok Pq Fl echok
330 .It Cm echoke Pq Fl echoke
333 character shall (shall
335 the current line from the
336 display, if possible.
337 .It Cm echonl Pq Fl echonl
342 .It Cm echoctl Pq Fl echoctl
345 is set, echo control characters as ^X.
346 Otherwise control characters echo as themselves.
347 .It Cm echoprt Pq Fl echoprt
348 For printing terminals.
349 If set, echo erased characters backwards within
353 Otherwise, disable this feature.
354 .It Cm noflsh Pq Fl noflsh
355 Disable (enable) flush after
356 .Dv INTR , QUIT , SUSP .
357 .It Cm tostop Pq Fl tostop
360 for background output.
361 This causes background jobs to stop if they attempt terminal output.
362 .It Cm altwerase Pq Fl altwerase
363 Use (do not use) an alternative word erase algorithm when processing
366 This alternative algorithm considers sequences of
367 alphanumeric/underscores as words.
368 It also skips the first preceding character in its classification
369 (as a convenience since the one preceding character could have been
370 erased with simply an
373 .It Cm mdmbuf Pq Fl mdmbuf
374 If set, flow control output based on condition of Carrier Detect.
375 Otherwise writes return an error if Carrier Detect is low (and Carrier
376 is not being ignored with the
379 .It Cm flusho Pq Fl flusho
380 Indicates output is (is not) being discarded.
381 .It Cm pendin Pq Fl pendin
382 Indicates input is (is not) pending after a switch from non-canonical
383 to canonical mode and will be re-input when a read becomes pending
384 or more input arrives.
386 .Ss Control Characters
388 .It Ar control-character Ar string
390 .Ar control-character
393 If the string is a single character,
394 then the control character is set to
397 two character sequence "^-" or the
398 string "undef", then the control character
399 is disabled (i.e., set to
400 .Bro Dv _POSIX_VDISABLE Brc ) .
402 Recognized control characters:
403 .Bd -ragged -offset indent
404 .Bl -column character Subscript Description
405 .It control- Ta "" Ta ""
406 .It character Subscript Description
407 .It _________ _________ _______________
408 .It eof Ta Tn VEOF Ta EOF No character
409 .It eol Ta Tn VEOL Ta EOL No character
410 .It eol2 Ta Tn VEOL2 Ta EOL2 No character
411 .It erase Ta Tn VERASE Ta ERASE No character
412 .It werase Ta Tn VWERASE Ta WERASE No character
413 .It kill Ta Tn VKILL Ta KILL No character
414 .It reprint Ta Tn VREPRINT Ta REPRINT No character
415 .It intr Ta Tn VINTR Ta INTR No character
416 .It quit Ta Tn VQUIT Ta QUIT No character
417 .It susp Ta Tn VSUSP Ta SUSP No character
418 .It dsusp Ta Tn VDSUSP Ta DSUSP No character
419 .It start Ta Tn VSTART Ta START No character
420 .It stop Ta Tn VSTOP Ta STOP No character
421 .It lnext Ta Tn VLNEXT Ta LNEXT No character
422 .It status Ta Tn VSTATUS Ta STATUS No character
423 .It discard Ta Tn VDISCARD Ta DISCARD No character
427 .It Cm time Ar number
428 Set the value of min or time to
434 Non-Canonical mode input processing
437 .Ss Combination Modes
439 .It Ar saved settings
440 Set the current terminal characteristics to the saved settings
444 .It Cm evenp No or Cm parity
445 Enable parenb and cs7; disable parodd.
447 Enable parenb, cs7, and parodd.
448 .It Fl parity , evenp , oddp
449 Disable parenb, and set cs8.
450 .It Cm \&nl Pq Fl \&nl
451 Enable (disable) icrnl.
453 -nl unsets inlcr and igncr.
459 characters back to system defaults.
461 Resets all modes to reasonable values for interactive terminal use.
463 Sets all modes to random values, which are very likely
464 .Pq but not guaranteed
465 to be unreasonable for interactive terminal use.
467 Set the line discipline to the standard terminal line discipline
470 Set (disable) all modes suitable for a CRT display device.
471 .It Cm kerninfo Pq Fl kerninfo
472 Enable (disable) the system generated status line associated with
475 character (usually set to ^T).
476 The status line consists of the
477 system load average, the current command name, its process ID, the
478 event the process is waiting on (or the status of the process), the user
479 and system times, percent CPU, and current memory usage.
480 .It Cm columns Ar number
481 The terminal size is recorded as having
484 .It Cm cols Ar number
487 .It Cm rows Ar number
488 The terminal size is recorded as having
492 Set modes suitable for users of Digital Equipment Corporation systems
497 characters are set to ^?, ^U, and ^C;
502 .It Cm extproc Pq Fl extproc
503 If set, this flag indicates that some amount of terminal processing is being
504 performed by either the terminal hardware or by the remote side connected
507 If set, change the modes of the terminal so that no input or output processing
509 If unset, change the modes of the terminal to some reasonable
510 state that performs input and output processing.
511 Note that since the terminal driver no longer has a single
513 bit, it is not possible to intuit what flags were set prior to setting
515 This means that unsetting
517 may not put back all the setting that were previously in effect.
518 To set the terminal into a raw state and then accurately restore it, the following
519 shell code is recommended:
520 .Bd -literal -offset indent
521 save_state=$(stty -g)
527 The size of the terminal is printed as two numbers on a single line,
528 first rows, then columns.
530 .Ss Compatibility Modes
531 These modes remain for compatibility with the previous version of
537 Reports all the terminal modes as with
539 except that the control characters are printed in a columnar format.
548 .Cm brkint , ixon , imaxbel , opost ,
560 .It Cm newcrt Pq Fl newcrt
566 .It Cm tandem Pq Fl tandem
569 .It Cm decctlq Pq Fl decctlq
572 .It Cm crterase Pq Fl crterase
575 .It Cm crtbs Pq Fl crtbs
578 .It Cm crtkill Pq Fl crtkill
581 .It Cm ctlecho Pq Fl ctlecho
584 .It Cm prterase Pq Fl prterase
587 .It Cm litout Pq Fl litout
590 .It Cm tabs Pq Fl tabs
594 Same as the control character
596 .It Cm flush Ar value
597 Same as the control character
599 .It Cm rprnt Ar value
600 Same as the control character
603 .Ss Control operations
604 These operations are not modes, but rather commands to be performed by
608 Performs a "start output" operation, as normally done by an
609 incoming START character when
613 Performs a "stop output" operation, as normally done by an
614 incoming STOP character when
626 utility is expected to be
634 extensions to the standard, as are the operands mentioned in the control