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