1 .\" $OpenBSD: stty.1,v 1.38 2011/09/03 22:59:08 jmc Exp $
2 .\" $NetBSD: stty.1,v 1.10 1995/09/07 06:57:14 jtc Exp $
4 .\" Copyright (c) 1990, 1993, 1994
5 .\" The Regents of the University of California. All rights reserved.
7 .\" This code is derived from software contributed to Berkeley by
8 .\" the Institute of Electrical and Electronics Engineers, Inc.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
18 .\" 3. Neither the name of the University nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" @(#)stty.1 8.5 (Berkeley) 6/1/94
36 .Dd $Mdocdate: September 3 2011 $
41 .Nd set the options for a terminal device interface
44 .Op Fl a | Fl e | Fl g
50 utility sets or reports on terminal
51 characteristics for the device that is its standard input.
52 If no options or operands are specified, it reports the settings of a subset
53 of characteristics as well as additional ones if they differ from their
56 the terminal state according to the specified arguments.
57 Some combinations of arguments are mutually
58 exclusive on some terminal types.
60 The options are as follows:
63 Display all the current settings for the terminal to standard output
67 Display all the current settings for the terminal to standard output
75 Open and use the terminal named by
77 rather than using standard input.
78 The file is opened using the
83 set or display settings on a terminal that might otherwise
86 Display all the current settings for the terminal to standard output
87 in a form that may be used as an argument to a subsequent invocation of
89 to restore the current terminal state as per
93 The following arguments are available to set the terminal
96 Control mode flags affect hardware characteristics associated with the
98 This corresponds to the
100 in the termios structure.
102 .It Cm parenb Pq Fl parenb
103 Enable (disable) parity generation
105 .It Cm parodd Pq Fl parodd
106 Select odd (even) parity.
107 .It Cm cs5 cs6 cs7 cs8
108 Select character size, if possible.
110 Set terminal baud rate to the
111 number given, if possible.
113 baud rate is set to zero, modem
116 .It Cm ispeed Ar number
117 Set terminal input baud rate to the
118 number given, if possible.
120 input baud rate is set to zero, the
121 input baud rate is set to the
122 value of the output baud
124 .It Cm ospeed Ar number
125 Set terminal output baud rate to
126 the number given, if possible.
128 the output baud rate is set to
129 zero, modem control is
131 .It Cm speed Ar number
138 .It Cm hupcl Pq Fl hupcl
139 Stop asserting modem control
140 (do not stop asserting modem control) on last close.
145 .It Cm cstopb Pq Fl cstopb
146 Use two (one) stop bits per character.
147 .It Cm cread Pq Fl cread
148 Enable (disable) the receiver.
149 .It Cm clocal Pq Fl clocal
150 Assume a line without (with) modem
152 .It Cm crtscts Pq Fl crtscts
153 Enable (disable) RTS/CTS flow control.
156 This corresponds to the
158 in the termios structure.
160 .It Cm ignbrk Pq Fl ignbrk
161 Ignore (do not ignore) break on
163 .It Cm brkint Pq Fl brkint
164 Signal (do not signal)
168 .It Cm ignpar Pq Fl ignpar
169 Ignore (do not ignore) parity
171 .It Cm parmrk Pq Fl parmrk
172 Mark (do not mark) parity errors.
173 .It Cm inpck Pq Fl inpck
174 Enable (disable) input parity
176 .It Cm istrip Pq Fl istrip
177 Strip (do not strip) input characters
179 .It Cm inlcr Pq Fl inlcr
185 .It Cm igncr Pq Fl igncr
186 Ignore (do not ignore)
189 .It Cm icrnl Pq Fl icrnl
195 .It Cm iuclc Pq Fl iuclc
196 Translate (do not translate) upper case to lower case
198 .It Cm ixon Pq Fl ixon
203 Output from the system is
204 stopped when the system receives
206 and started when the system
211 is set, any character restarts output.
212 .It Cm ixoff Pq Fl ixoff
213 Request that the system send (not
217 the input queue is nearly
219 .It Cm ixany Pq Fl ixany
220 Allow any character (allow only
223 .It Cm imaxbel Pq Fl imaxbel
224 The system imposes a limit of
226 (currently 255) characters in the input queue.
229 is set and the input queue limit has been reached,
230 subsequent input causes the system to send an ASCII BEL
231 character to the output queue (the terminal beeps at you).
234 is unset and the input queue is full, the next input character causes
235 the entire input and output queues to be discarded.
238 This corresponds to the
240 of the termios structure.
242 .It Cm opost Pq Fl opost
243 Post-process output (do not
244 post-process output; ignore all other
246 .It Cm onlcr Pq Fl onlcr
252 .It Cm ocrnl Pq Fl ocrnl
253 Translate (do not translate) carriage return to newline on output.
254 .It Cm onocr Pq Fl onocr
255 Carriage return is output (is not output) at column 0.
256 .It Cm onlret Pq Fl onlret
257 Newline performs (does not perform) carriage return on output.
258 .It Cm olcuc Pq Fl olcuc
259 Translate (do not translate) lower case to upper case on output.
260 .It Cm oxtabs Pq Fl oxtabs
261 Expand (do not expand) tabs to spaces on output.
262 .It Cm onoeot Pq Fl onoeot
263 Discard (do not discard) EOFs on output.
266 Local mode flags (lflags) affect various and sundry characteristics of terminal
268 Historically the term "local" pertained to new job control features
269 implemented by Jim Kulp on a
273 Later the driver ran on the first
275 at Evans Hall, UC Berkeley, where the job control details
276 were greatly modified but the structure definitions and names
277 remained essentially unchanged.
278 The second interpretation of the
281 .Dq line discipline flag
282 which corresponds to the
284 of the termios structure.
286 .It Cm isig Pq Fl isig
287 Enable (disable) the checking of
288 characters against the special control
293 .It Cm icanon Pq Fl icanon
294 Enable (disable) canonical input
299 .It Cm iexten Pq Fl iexten
300 Enable (disable) any implementation
301 defined special control characters
302 not currently controlled by
307 .It Cm echo Pq Fl echo
308 Echo back (do not echo back) every
310 .It Cm echoe Pq Fl echoe
313 character shall (shall
314 not) visually erase the last character
315 in the current line from the
316 display, if possible.
317 .It Cm echok Pq Fl echok
323 .It Cm echoke Pq Fl echoke
326 character shall (shall
327 not) visually erase the
328 current line from the
329 display, if possible.
330 .It Cm echonl Pq Fl echonl
335 .It Cm echoctl Pq Fl echoctl
338 is set, echo control characters as
340 Otherwise control characters echo as themselves.
341 .It Cm echoprt Pq Fl echoprt
342 For printing terminals.
343 If set, echo erased characters backwards within
347 Otherwise, disable this feature.
348 .It Cm noflsh Pq Fl noflsh
349 Disable (enable) flush after
350 .Dv INTR , QUIT , SUSP .
351 .It Cm tostop Pq Fl tostop
354 for background output.
355 This causes background jobs to stop if they attempt
357 .It Cm altwerase Pq Fl altwerase
358 Use (do not use) an alternate word erase algorithm when processing
361 This alternate algorithm considers sequences of
362 alphanumeric/underscores as words.
363 It also skips the first preceding character in its classification
364 (as a convenience since the one preceding character could have been
365 erased with simply an
368 .It Cm mdmbuf Pq Fl mdmbuf
369 If set, flow control output based on condition of Carrier Detect.
371 writes return an error if Carrier Detect is low (and Carrier is not being
375 .It Cm flusho Pq Fl flusho
376 Indicates output is (is not) being discarded.
377 .It Cm pendin Pq Fl pendin
378 Indicates input is (is not) pending after a switch from non-canonical
379 to canonical mode and will be re-input when a read becomes pending
380 or more input arrives.
381 .It Cm xcase Pq Fl xcase
382 Upper and lower case is (is not) handled canonically on input and output
388 .Ss Control characters
390 .It Ar control-character Ar string
392 .Ar control-character
395 If string is a single character,
396 the control character is set to
399 two character sequence
403 the control character
404 is disabled (i.e., set to
405 .Pf { Dv _POSIX_VDISABLE Ns } ) .
407 Recognized control-characters:
408 .Bl -column "character" "Subscript" "Description"
409 .It Sy Control Ta Sy Subscript Ta Sy Description
410 .It Sy character Ta "" Ta ""
411 .It eof Ta Dv VEOF Ta "EOF character"
412 .It eol Ta Dv VEOL Ta "EOL character"
413 .It eol2 Ta Dv VEOL2 Ta "EOL2 character"
414 .It erase Ta Dv VERASE Ta "ERASE character"
415 .It werase Ta Dv VWERASE Ta "WERASE character"
416 .It intr Ta Dv VINTR Ta "INTR character"
417 .It kill Ta Dv VKILL Ta "KILL character"
418 .It quit Ta Dv VQUIT Ta "QUIT character"
419 .It susp Ta Dv VSUSP Ta "SUSP character"
420 .It start Ta Dv VSTART Ta "START character"
421 .It stop Ta Dv VSTOP Ta "STOP character"
422 .It dsusp Ta Dv VDSUSP Ta "DSUSP character"
423 .It lnext Ta Dv VLNEXT Ta "LNEXT character"
424 .It reprint Ta Dv VREPRINT Ta "REPRINT character"
425 .It status Ta Dv VSTATUS Ta "STATUS character"
428 .It Cm time Ar number
429 Set the value of min or time to
435 non-canonical mode input processing
438 .Ss Combination modes
440 .It Ar saved settings
441 Set the current terminal
442 characteristics to the saved settings
446 .It Cm evenp No or Cm parity
447 Enable parenb and cs7; disable
455 .It Fl parity , evenp , oddp
460 .It Cm \&nl Pq Fl \&nl
475 back to system defaults.
477 Resets all modes to reasonable values for interactive terminal use.
479 Set the line discipline to the standard terminal line discipline
482 Set (disable) all modes suitable for a CRT display device.
483 .It Cm kerninfo Pq Fl kerninfo
484 Enable (disable) the system generated status line associated with
487 character (usually set to
489 The status line consists of the
490 system load average, the current command name, its process ID, the
491 event the process is waiting on (or the status of the process), the user
492 and system times, percent CPU, and current memory usage.
493 .It Cm columns Ar number
494 The terminal size is recorded as having
497 .It Cm cols Ar number
500 .It Cm rows Ar number
501 The terminal size is recorded as having
505 Set modes suitable for users of Digital Equipment Corporation systems
510 characters are set to ^?, ^U, and ^C;
515 .It Cm extproc Pq Fl extproc
516 If set, this flag indicates that some amount of terminal processing is being
517 performed by either the terminal hardware or by the remote side connected
520 If set, change the modes of the terminal so that no input or output processing
522 If unset, change the modes of the terminal to some reasonable
523 state that performs input and output processing.
524 Note that since the terminal driver no longer has a single
526 bit, it is not possible to intuit what flags were set prior to setting
528 This means that unsetting
530 may not put back all the setting that were previously in effect.
531 To set the terminal into a raw state and then accurately restore it,
532 the following shell code is recommended:
533 .Bd -literal -offset indent
534 save_state=$(stty -g)
540 The size of the terminal is printed as two numbers on a single line,
541 first rows, then columns.
543 .Ss Compatibility modes
544 These modes remain for compatibility with the previous version of
548 Reports all the terminal modes as with
550 except that the control characters are printed in a columnar format.
559 .Cm brkint , ixon , imaxbel , opost ,
571 .It Cm newcrt Pq Fl newcrt
577 .It Cm tandem Pq Fl tandem
580 .It Cm decctlq Pq Fl decctlq
583 .It Cm crterase Pq Fl crterase
586 .It Cm crtbs Pq Fl crtbs
589 .It Cm crtkill Pq Fl crtkill
592 .It Cm ctlecho Pq Fl ctlecho
595 .It Cm prterase Pq Fl prterase
598 .It Cm lcase Pq Fl lcase
604 .It Cm litout Pq Fl litout
607 .It Cm tabs Pq Fl tabs
611 Same as the control character
613 .It Cm flush Ar value
614 Same as the control character
616 .It Cm rprnt Ar value
617 Same as the control character
620 .Ss Control operations
621 These operations are not modes, but rather commands to be performed by
627 operation, as normally done by an
636 operation, as normally done by an incoming
650 utility is compliant with the
681 the compatibility modes and the control operations
682 are extensions to that specification.