xref: /original-bsd/bin/stty/stty.1 (revision 5429b474)
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)stty.1	6.7 (Berkeley) 07/24/90
7.\"
8.Dd
9.Dt STTY 1
10.Os BSD 4.4
11.Sh NAME
12.Nm stty
13.Nd Set the options for a terminal.
14.Sh SYNOPSIS
15.Nm stty
16.Op Fl a Ar \&| Fl g
17.Nm stty
18.Op arguments
19.De
20.Sh DESCRIPTION
21The stty utility sets or reports on terminal I/O
22characteristics for the device that is its standard input.
23Without options or arguments specified, it reports the
24settings of certain characteristics, usually those that differ
25from implementation-defined defaults.
26Otherwise it modifies
27the terminal state according to the specified arguments.
28Some combinations of arguments are mutually
29exclusive on some terminal types.
30.Pp
31The following options are available:
32.Tw Ds
33.Tp Fl a
34Write to standard output all the current settings
35for the terminal.
36.Tp Fl g
37Write to standard output the current settings in an
38unspecified form that can be used as arguments to
39another stty utility on the same system.
40.Tp
41.Pp
42The following arguments are available to set the terminal
43characteristics:
44.Tw Fl
45.Tc Cm parenb
46.Ws
47.Pf \&( Fl parenb )
48.Cx
49Enable (disable) parity generation
50and detection.
51.Tc Cm parodd
52.Ws
53.Pf \&( Fl parodd )
54.Cx
55Select odd (even) parity.
56.Tp Cm cs5 cs6 cs7 cs8
57Select character size, if possible.
58.Tp Ar number
59Set terminal baud rate to the
60number given, if possible.
61If the
62baud rate is set to zero, modem
63control is no longer
64asserted.
65.Tc Cm ispeed
66.Ws
67.Ar number
68.Cx
69Set terminal input baud rate to the
70number given, if possible.
71If the
72input baud rate is set to zero, the
73input baud rate is set to the
74value of the output baud
75rate.
76.Tc Cm ospeed
77.Ws
78.Ar number
79.Cx
80Set terminal output baud rate to
81the number given, if possible.
82If
83the output baud rate is set to
84zero, modem control is
85no longer asserted.
86.Tc Cm hupcl
87.Ws
88.Pf \&( Fl hupcl )
89.Cx
90Stop asserting modem control
91(do not stop asserting modem control) on last close.
92.Tc Cm hup
93.Ws
94.Pf \&( Fl hup )
95.Cx
96Same as hupcl
97.Ws
98.Pf \&( Fl hupcl).
99.Tc Cm cstopb
100.Ws
101.Pf \&( Fl cstopb )
102.Cx
103Use two (one) stop bits per character.
104.Tc Cm cread
105.Ws
106.Pf \&( Fl cread )
107.Cx
108Enable (disable) the receiver.
109.Tc Cm clocal
110.Ws
111.Pf \&( Fl clocal )
112.Cx
113Assume a line without (with) modem
114control.
115.Tc Cm ignbrk
116.Ws
117.Pf \&( Fl ignbrk )
118.Cx
119Ignore (do not ignore) break on
120input.
121.Tc Cm brkint
122.Ws
123.Pf \&( Fl brkint )
124.Cx
125Signal (do not signal) INTR on
126break.
127.Tc Cm ignpar
128.Ws
129.Pf \&( Fl ignpar )
130.Cx
131Ignore (do not ignore) parity
132errors.
133.Tc Cm parmrk
134.Ws
135.Pf \&( Fl parmrk )
136.Cx
137Mark (do not mark) parity errors.
138.Tc Cm inpck
139.Ws
140.Pf \&( Fl inpck )
141.Cx
142Enable (disable) input parity
143checking.
144.Tc Cm istrip
145.Ws
146.Pf \&( Fl istrip )
147.Cx
148Strip (do not strip) input characters
149to seven bits.
150.Tc Cm inlcr
151.Ws
152.Pf \&( Fl inlcr )
153.Cx
154Map (do not map) NL to CR on input.
155.Tc Cm igncr
156.Ws
157.Pf \&( Fl igncr )
158.Cx
159Ignore (do not ignore) CR on input.
160.Tc Cm icrnl
161.Ws
162.Pf \&( Fl icrnl )
163.Cx
164Map (do not map) CR to NL on input.
165.Tc Cm ixon
166.Ws
167.Pf \&( Fl ixon )
168.Cx
169Enable (disable) START/STOP output
170control.
171Output from the system is
172stopped when the system receives
173STOP and started when the system
174receives START.
175.Tc Cm ixoff
176.Ws
177.Pf \&( Fl ixoff )
178.Cx
179Request that the system send (not
180send) START/STOP characters when
181the input queue is nearly
182empty/full.
183.Tc Cm opost
184.Ws
185.Pf \&( Fl opost )
186.Cx
187Post-process output (do not
188post-process output; ignore all other
189output modes).
190.Tc Cm isig
191.Ws
192.Pf \&( Fl isig )
193.Cx
194Enable (disable) the checking of
195characters against the special control
196characters INTR, QUIT, and
197SUSP.
198.Tc Cm icanon
199.Ws
200.Pf \&( Fl icanon )
201.Cx
202Enable (disable) canonical input
203(ERASE and KILL processing).
204.Tc Cm iexten
205.Ws
206.Pf \&( Fl iexten )
207.Cx
208Enable (disable) any implementation
209defined special control characters
210not currently controlled by icanon,
211isig, or ixon.
212.Tc Cm echo
213.Ws
214.Pf \&( Fl echo )
215.Cx
216Echo back (do not echo back) every
217character typed.
218.Tc Cm echoe
219.Ws
220.Pf \&( Fl echoe )
221.Cx
222The ERASE character shall (shall
223not) visually erase the last character
224in the current line from the
225display, if possible.
226.Tc Cm echok
227.Ws
228.Pf \&( Fl echok )
229.Cx
230Echo (do not echo) NL after KILL
231character.
232.Tc Cm echonl
233.Ws
234.Pf \&( Fl echonl )
235.Cx
236Echo (do not echo) NL, even if echo
237is disabled.
238.Tc Cm noflsh
239.Ws
240.Pf \&( Fl noflsh )
241.Cx
242Disable (enable) flush after INTR,
243QUIT, SUSP.
244.Tc Cm control-character
245.Ws
246.Ar string
247.Cx
248Set control-character to string.
249If string is a single character,
250the control character is set to
251that character.
252If string is the
253two character sequence "^-" or the
254string "undef" the control character
255is set to {_POSIX_VDISABLE} if
256it is in effect for the device; if
257{_POSIX_VDISABLE} is not in effect
258for the device, it is an
259error.
260.Pp
261Recognized control-characters:
262.Ds I
263.Cw character Subscript
264.Cl control-	POSIX.1
265.Cl character	Subscript	Description
266.Cl _________	_________	_______________
267.Cl eof	VEOF	EOF character
268.Cl eol	VEOL	EOL character
269.Cl erase	VERASE	ERASE character
270.Cl intr	VINTR	INTR character
271.Cl kill	VKILL	KILL character
272.Cl quit	VQUIT	QUIT character
273.Cl susp	VSUSP	SUSP character
274.Cl start	VSTART	START character
275.Cl stop	VSTOP	STOP character
276.Cw
277.De
278.Tp Cm saved settings
279Set the current terminal
280characteristics to the saved settings
281produced by the -g option.
282.Tc Cm min
283.Ws
284.Ar number
285.Cx
286time number
287Set the value of min or time to
288number.
289MIN and TIME are used in
290Non-Canonical mode input processing
291(-icanon).
292.Tc Cm evenp
293.Ws
294.Cx or
295.Ws
296.Cm parity
297.Cx
298Enable parenb and cs7; disable
299parodd.
300.Tp Cm oddp
301Enable parenb, cs7, and parodd.
302.Tp Fl parity , evenp ,  oddp
303Disable parenb, and set cs8.
304.Tc Cm nl
305.Ws
306.Pf \&( Fl nl )
307.Cx
308Enable (disable) icrnl.
309In addition
310-nl unsets inlcr and igncr.
311.Tp Cm ek
312Reset ERASE and KILL characters
313back to system defaults.
314.Tp Cm sane
315Resets all modes to some reasonable,
316unspecified, values.
317.Tp
318.Pp
319If the -g option is specified, stty writes to standard output
320the current settings in a form that can be used as arguments
321to another instance of stty on the same system.
322.Pp
323If the -a option is specified, all of the information as
324described in arguments is written to standard output.
325Unless
326otherwise specified, this information shall be displayed as
327<space>-separated tokens in an unspecified format, on one or
328more lines, with an unspecified number of tokens per line.
329Additional information may be displayed as well.
330.Pp
331If no options are specified, an unspecified subset of the
332information displayed for the -a option is displayed.
333.Pp
334If the terminal input speed and output speed are the same,
335the speed information is displayed as follows:
336.Pp
337.Ds I
338"speed %d baud;", <speed>
339.De
340.Pp
341Otherwise speeds are displayed as:
342.Pp
343.Ds I
344"ispeed %d baud; ospeed %d baud;", <ispeed>, <ospeed>
345.De
346.Pp
347Control characters are displayed as:
348.Pp
349.Ds I
350"%s = %s;", <control-character name>, <value>
351.De
352.Pp
353where value is either the character, or some visual
354representation of the character if it is non-printing, or
355the string "<undef>" if the character is disabled.
356.Pp
357The
358.Nm stty
359utility exits with one of the following values:
360.Tw Ds
361.Tp Li \&0
362The terminal options were read or set successfully.
363.Tp Li \&>0
364An error occurred.
365.Tp
366.Sh SEE ALSO
367.Xr stty 4
368.Sh STANDARDS
369The
370.Nm stty
371function is expected to be POSIX 1003.2 compatible.
372