1 .\" Copyright (c) 1990, 1993, 1994
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" @(#)stty.1 8.4 (Berkeley) 4/18/94
32 .\" $FreeBSD: src/bin/stty/stty.1,v 1.13.2.6 2001/12/14 14:22:09 ru Exp $
39 .Nd set the options for a terminal device interface
42 .Op Fl a | Fl e | Fl g
48 utility sets or reports on terminal
49 characteristics for the device that is its standard input.
50 If no options or operands are specified, it reports the settings of a subset
51 of characteristics as well as additional ones if they differ from their
54 the terminal state according to the specified arguments.
55 Some combinations of arguments are mutually
56 exclusive on some terminal types.
58 The following options are available:
59 .Bl -tag -width indent
61 Display all the current settings for the terminal to standard output
65 Display all the current settings for the terminal to standard output
68 ``all'' and ``everything'' formats.
70 Open and use the terminal named by
72 rather than using standard input.
73 The file is opened using the
78 set or display settings on a terminal that might otherwise
81 Display all the current settings for the terminal to standard output
82 in a form that may be used as an argument to a subsequent invocation of
84 to restore the current terminal state as per
88 The following arguments are available to set the terminal
91 Control mode flags affect hardware characteristics associated with the
93 This corresponds to the c_cflag in the termios structure.
95 .It Cm parenb Pq Fl parenb
96 Enable (disable) parity generation
98 .It Cm parodd Pq Fl parodd
99 Select odd (even) parity.
100 .It Cm cs5 cs6 cs7 cs8
101 Select character size, if possible.
103 Set terminal baud rate to the
104 number given, if possible.
106 baud rate is set to zero, modem
109 .It Cm ispeed Ar number
110 Set terminal input baud rate to the
111 number given, if possible.
113 input baud rate is set to zero, the
114 input baud rate is set to the
115 value of the output baud
117 .It Cm ospeed Ar number
118 Set terminal output baud rate to
119 the number given, if possible.
121 the output baud rate is set to
122 zero, modem control is
124 .It Cm speed Ar number
131 .It Cm hupcl Pq Fl hupcl
132 Stop asserting modem control
133 (do not stop asserting modem control) on last close.
137 .It Cm cstopb Pq Fl cstopb
138 Use two (one) stop bits per character.
139 .It Cm cread Pq Fl cread
140 Enable (disable) the receiver.
141 .It Cm clocal Pq Fl clocal
142 Assume a line without (with) modem
144 .It Cm crtscts Pq Fl crtscts
145 Enable (disable) RTS/CTS flow control.
148 This corresponds to the c_iflag in the termios structure.
150 .It Cm ignbrk Pq Fl ignbrk
151 Ignore (do not ignore) break on
153 .It Cm brkint Pq Fl brkint
154 Signal (do not signal)
158 .It Cm ignpar Pq Fl ignpar
159 Ignore (do not ignore) characters with parity
161 .It Cm parmrk Pq Fl parmrk
162 Mark (do not mark) characters with parity errors.
163 .It Cm inpck Pq Fl inpck
164 Enable (disable) input parity
166 .It Cm istrip Pq Fl istrip
167 Strip (do not strip) input characters
169 .It Cm inlcr Pq Fl inlcr
175 .It Cm igncr Pq Fl igncr
176 Ignore (do not ignore)
179 .It Cm icrnl Pq Fl icrnl
185 .It Cm ixon Pq Fl ixon
190 Output from the system is
191 stopped when the system receives
193 and started when the system
198 is set, any character restarts output.
199 .It Cm ixoff Pq Fl ixoff
200 Request that the system send (not
204 the input queue is nearly
206 .It Cm ixany Pq Fl ixany
207 Allow any character (allow only
210 .It Cm imaxbel Pq Fl imaxbel
211 The system imposes a limit of
213 (currently 255) characters in the input queue.
216 is set and the input queue limit has been reached,
217 subsequent input causes the system to send an ASCII BEL
218 character to the output queue (the terminal beeps at you).
221 is unset and the input queue is full, the next input character causes
222 the entire input and output queues to be discarded.
225 This corresponds to the c_oflag of the termios structure.
227 .It Cm opost Pq Fl opost
228 Post-process output (do not
229 post-process output; ignore all other
231 .It Cm onlcr Pq Fl onlcr
237 .It Cm ocrnl Pq Fl ocrnl
243 .It Cm oxtabs Pq Fl oxtabs
244 Expand (do not expand) tabs to spaces on output.
245 .It Cm onocr Pq Fl onocr
246 Do not (do) output CRs at column zero.
247 .It Cm onlret Pq Fl onlret
248 On the terminal NL performs (does not perform) the CR function.
251 Local mode flags (lflags) affect various and sundry characteristics of terminal
253 Historically the term "local" pertained to new job control features
254 implemented by Jim Kulp on a
258 Later the driver ran on the first
260 at Evans Hall, UC Berkeley, where the job control details
261 were greatly modified but the structure definitions and names
262 remained essentially unchanged.
263 The second interpretation of the 'l' in lflag
264 is ``line discipline flag'' which corresponds to the
270 .It Cm isig Pq Fl isig
271 Enable (disable) the checking of
272 characters against the special control
277 .It Cm icanon Pq Fl icanon
278 Enable (disable) canonical input
283 .It Cm iexten Pq Fl iexten
284 Enable (disable) any implementation
285 defined special control characters
286 not currently controlled by icanon,
288 .It Cm echo Pq Fl echo
289 Echo back (do not echo back) every
291 .It Cm echoe Pq Fl echoe
294 character shall (shall
295 not) visually erase the last character
296 in the current line from the
297 display, if possible.
298 .It Cm echok Pq Fl echok
304 .It Cm echoke Pq Fl echoke
307 character shall (shall
308 not) visually erase the
309 current line from the
310 display, if possible.
311 .It Cm echonl Pq Fl echonl
316 .It Cm echoctl Pq Fl echoctl
319 is set, echo control characters as ^X.
320 Otherwise control characters echo as themselves.
321 .It Cm echoprt Pq Fl echoprt
322 For printing terminals.
323 If set, echo erased characters backwards within ``\\''
325 Otherwise, disable this feature.
326 .It Cm noflsh Pq Fl noflsh
327 Disable (enable) flush after
328 .Dv INTR , QUIT , SUSP .
329 .It Cm tostop Pq Fl tostop
332 for background output.
333 This causes background jobs to stop if they attempt terminal output.
334 .It Cm altwerase Pq Fl altwerase
335 Use (do not use) an alternate word erase algorithm when processing
338 This alternate algorithm considers sequences of
339 alphanumeric/underscores as words.
340 It also skips the first preceding character in its classification
341 (as a convenience since the one preceding character could have been
342 erased with simply an
345 .It Cm mdmbuf Pq Fl mdmbuf
346 If set, flow control output based on condition of Carrier Detect.
348 writes return an error if Carrier Detect is low (and Carrier is not being
352 .It Cm flusho Pq Fl flusho
353 Indicates output is (is not) being discarded.
354 .It Cm pendin Pq Fl pendin
355 Indicates input is (is not) pending after a switch from non-canonical
356 to canonical mode and will be re-input when a read becomes pending
357 or more input arrives.
359 .Ss Control Characters:
361 .It Ar control-character Ar string
363 .Ar control-character
366 If string is a single character,
367 the control character is set to
370 two character sequence "^-" or the
371 string "undef" the control character
372 is disabled (i.e.\& set to
373 .Pf { Dv _POSIX_VDISABLE Ns } . )
375 Recognized control-characters:
376 .Bl -column "character" "Subscript" "Description"
377 .It Sy Control Ta Sy Subscript Ta Sy Description
378 .It Sy character Ta "" Ta ""
379 .It eof Ta Dv VEOF Ta "EOF character"
380 .It eol Ta Dv VEOL Ta "EOL character"
381 .It eol2 Ta Dv VEOL2 Ta "EOL2 character"
382 .It erase Ta Dv VERASE Ta "ERASE character"
383 .It erase2 Ta Dv VERASE2 Ta "ERASE2 character"
384 .It werase Ta Dv VWERASE Ta "WERASE character"
385 .It intr Ta Dv VINTR Ta "INTR character"
386 .It kill Ta Dv VKILL Ta "KILL character"
387 .It quit Ta Dv VQUIT Ta "QUIT character"
388 .It susp Ta Dv VSUSP Ta "SUSP character"
389 .It start Ta Dv VSTART Ta "START character"
390 .It stop Ta Dv VSTOP Ta "STOP character"
391 .It dsusp Ta Dv VDSUSP Ta "DSUSP character"
392 .It lnext Ta Dv VLNEXT Ta "LNEXT character"
393 .It reprint Ta Dv VREPRINT Ta "REPRINT character"
394 .It status Ta Dv VSTATUS Ta "STATUS character"
395 .It ckpt Ta Dv VCHECKPT Ta "CKPT character"
398 .It Cm time Ar number
399 Set the value of min or time to
405 Non-Canonical mode input processing
408 .Ss Combination Modes:
410 .It Ar saved settings
411 Set the current terminal
412 characteristics to the saved settings
416 .It Cm evenp No or Cm parity
417 Enable parenb and cs7; disable
420 Enable parenb, cs7, and parodd.
421 .It Fl parity , evenp , oddp
422 Disable parenb, and set cs8.
423 .It Cm \&nl Pq Fl \&nl
424 Enable (disable) icrnl.
426 -nl unsets inlcr and igncr.
434 back to system defaults.
436 Resets all modes to reasonable values for interactive terminal use.
438 Set the line discipline to the standard terminal line discipline
441 Set (disable) all modes suitable for a CRT display device.
442 .It Cm kerninfo Pq Fl kerninfo
443 Enable (disable) the system generated status line associated with
446 character (usually set to ^T).
447 The status line consists of the
448 system load average, the current command name, its process ID, the
449 event the process is waiting on (or the status of the process), the user
450 and system times, percent cpu, and current memory usage.
451 .It Cm columns Ar number
452 The terminal size is recorded as having
455 .It Cm cols Ar number
458 .It Cm rows Ar number
459 The terminal size is recorded as having
463 Set modes suitable for users of Digital Equipment Corporation systems
468 characters are set to ^?, ^U, and ^C;
473 .It Cm extproc Pq Fl extproc
474 If set, this flag indicates that some amount of terminal processing is being
475 performed by either the terminal hardware or by the remote side connected
478 If set, change the modes of the terminal so that no input or output processing
480 If unset, change the modes of the terminal to some reasonable
481 state that performs input and output processing.
482 Note that since the terminal driver no longer has a single
484 bit, it is not possible to intuit what flags were set prior to setting
486 This means that unsetting
488 may not put back all the setting that were previously in effect.
489 To set the terminal into a raw state and then accurately restore it, the following
490 shell code is recommended:
492 save_state=$(stty -g)
498 The size of the terminal is printed as two numbers on a single line,
499 first rows, then columns.
501 .Ss Compatibility Modes:
502 These modes remain for compatibility with the previous version of
508 Reports all the terminal modes as with
510 except that the control characters are printed in a columnar format.
519 .Cm brkint , ixon , imaxbel , opost ,
531 .It Cm newcrt Pq Fl newcrt
537 .It Cm tandem Pq Fl tandem
540 .It Cm decctlq Pq Fl decctlq
543 .It Cm crterase Pq Fl crterase
546 .It Cm crtbs Pq Fl crtbs
549 .It Cm crtkill Pq Fl crtkill
552 .It Cm ctlecho Pq Fl ctlecho
555 .It Cm prterase Pq Fl prterase
558 .It Cm litout Pq Fl litout
561 .It Cm tabs Pq Fl tabs
565 Same as the control character
567 .It Cm flush Ar value
568 Same as the control character
570 .It Cm rprnt Ar value
571 Same as the control character
581 utility is expected to be
589 extensions to the standard.