xref: /original-bsd/bin/stty/stty.1 (revision c6d5c0d7)
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.8 (Berkeley) 02/06/91
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 device interface
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 the current settings to standard output in a
38form 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
282.Fl g
283option.
284.Tc Cm min
285.Ws
286.Ar number
287.Cx
288.Tc Cm time
289.Ws
290.Ar number
291.Cx
292Set the value of min or time to
293number.
294MIN and TIME are used in
295Non-Canonical mode input processing
296(-icanon).
297.Tc Cm evenp
298.Ws
299.Cx or
300.Ws
301.Cm parity
302.Cx
303Enable parenb and cs7; disable
304parodd.
305.Tp Cm oddp
306Enable parenb, cs7, and parodd.
307.Tp Fl parity , evenp ,  oddp
308Disable parenb, and set cs8.
309.Tc Cm nl
310.Ws
311.Pf \&( Fl nl )
312.Cx
313Enable (disable) icrnl.
314In addition
315-nl unsets inlcr and igncr.
316.Tp Cm ek
317Reset ERASE and KILL characters
318back to system defaults.
319.Tp Cm sane
320Resets all modes to reasonable values for interactive terminal use.
321.Tp Cm tty
322Set the line discipline to the standard terminal line discipline TTYDISC.
323.Tp
324.Pp
325If the
326.Fl g
327option is specified, stty writes to standard output
328the current settings in a form that can be used as arguments
329to another instance of stty on the same system.
330.Pp
331If the
332.Fl a
333option is specified, all of the information about the current setting
334is written to standard output
335in the same format described for the arguments above.
336Unless otherwise specified, this information is displayed as
337<space>-separated tokens, on one or
338more lines, with one or more tokens per line.
339.Pp
340If no options are specified, a subset of the
341information displayed for the
342.Fl a
343option is displayed.
344.Pp
345If the terminal input speed and output speed are the same,
346the speed information is displayed as follows:
347.Pp
348.Ds I
349"speed %d baud;", <speed>
350.De
351.Pp
352Otherwise speeds are displayed as:
353.Pp
354.Ds I
355"ispeed %d baud; ospeed %d baud;", <ispeed>, <ospeed>
356.De
357.Pp
358Control characters are displayed as:
359.Pp
360.Ds I
361"%s = %s;", <control-character name>, <value>
362.De
363.Pp
364where value is either the character, or some visual
365representation of the character if it is non-printing, or
366the string "<undef>" if the character is disabled.
367.Pp
368The
369.Nm stty
370utility exits with one of the following values:
371.Tw Ds
372.Tp Li \&0
373The terminal options were read or set successfully.
374.Tp Li \&>0
375An error occurred.
376.Tp
377.Sh SEE ALSO
378.Xr stty 4
379.Sh STANDARDS
380The
381.Nm stty
382function is expected to be POSIX 1003.2 compatible.
383