xref: /original-bsd/bin/stty/stty.1 (revision 3b6250d9)
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
7.\" %sccs.include.redist.man%
8.\"
9.\"     @(#)stty.1	6.16 (Berkeley) 11/08/91
10.\"
11.Dd
12.Dt STTY 1
13.Os
14.Sh NAME
15.Nm stty
16.Nd set the options for a terminal device interface
17.Sh SYNOPSIS
18.Nm stty
19.Op Fl a | Fl e | Fl g
20.Op Fl f Ar file
21.Op operands
22.Sh DESCRIPTION
23The
24.Nm stty
25utility sets or reports on terminal
26characteristics for the device that is its standard input.
27If no options or operands are specified, it reports the settings of a set
28of characteristics as well as additional ones if they differ from their
29default values.
30Otherwise it modifies
31the terminal state according to the specified arguments.
32Some combinations of arguments are mutually
33exclusive on some terminal types.
34.Pp
35The following options are available:
36.Bl -tag -width Ds
37.It Fl a
38Display all the current settings for the terminal to standard output
39as per
40.St -p1003.2 .
41.It Fl e
42Display all the current settings for the terminal to standard output
43in the traditional
44.Tn BSD
45``all'' and ``everything'' formats.
46.It Fl f
47Display the current settings for the terminal named by
48.Ar file .
49.It Fl g
50Display all the current settings for the terminal to standard output
51in a form that may be used as an argument to a subsequent invocation of
52.Nm stty
53to restore the current terminal state as per
54.St -p1003.2 .
55.El
56.Pp
57The following arguments are available to set the terminal
58characteristics:
59.Bl -tag -width Fl
60.It Cm parenb Pq Fl parenb
61Enable (disable) parity generation
62and detection.
63.It Cm parodd Pq Fl parodd
64Select odd (even) parity.
65.It Cm cs5 cs6 cs7 cs8
66Select character size, if possible.
67.It Ar number
68Set terminal baud rate to the
69number given, if possible.
70If the
71baud rate is set to zero, modem
72control is no longer
73asserted.
74.It Cm ispeed Ar number
75Set terminal input baud rate to the
76number given, if possible.
77If the
78input baud rate is set to zero, the
79input baud rate is set to the
80value of the output baud
81rate.
82.It Cm ospeed Ar number
83Set terminal output baud rate to
84the number given, if possible.
85If
86the output baud rate is set to
87zero, modem control is
88no longer asserted.
89.It Cm hupcl Pq Fl hupcl
90Stop asserting modem control
91(do not stop asserting modem control) on last close.
92.It Cm hup Pq Fl hup
93Same as hupcl
94.Pq Fl hupcl .
95.It Cm cstopb Pq Fl cstopb
96Use two (one) stop bits per character.
97.It Cm cread Pq Fl cread
98Enable (disable) the receiver.
99.It Cm clocal Pq Fl clocal
100Assume a line without (with) modem
101control.
102.It Cm ignbrk Pq Fl ignbrk
103Ignore (do not ignore) break on
104input.
105.It Cm brkint Pq Fl brkint
106Signal (do not signal)
107.Dv INTR
108on
109break.
110.It Cm ignpar Pq Fl ignpar
111Ignore (do not ignore) parity
112errors.
113.It Cm parmrk Pq Fl parmrk
114Mark (do not mark) parity errors.
115.It Cm inpck Pq Fl inpck
116Enable (disable) input parity
117checking.
118.It Cm istrip Pq Fl istrip
119Strip (do not strip) input characters
120to seven bits.
121.It Cm inlcr Pq Fl inlcr
122Map (do not map)
123.Dv NL
124to
125.Dv CR
126on input.
127.It Cm igncr Pq Fl igncr
128Ignore (do not ignore)
129.Dv CR
130on input.
131.It Cm icrnl Pq Fl icrnl
132Map (do not map)
133.Dv CR
134to
135.Dv NL
136on input.
137.It Cm ixon Pq Fl ixon
138Enable (disable)
139.Dv START/STOP
140output
141control.
142Output from the system is
143stopped when the system receives
144.Dv STOP
145and started when the system
146receives
147.Dv START .
148.It Cm ixoff Pq Fl ixoff
149Request that the system send (not
150send)
151.Dv START/STOP
152characters when
153the input queue is nearly
154empty/full.
155.It Cm opost Pq Fl opost
156Post-process output (do not
157post-process output; ignore all other
158output modes).
159.It Cm isig Pq Fl isig
160Enable (disable) the checking of
161characters against the special control
162characters
163.Dv INTR , QUIT ,
164and
165.Dv SUSP .
166.It Cm icanon Pq Fl icanon
167Enable (disable) canonical input
168.Pf ( Dv ERASE
169and
170.Dv KILL
171processing).
172.It Cm iexten Pq Fl iexten
173Enable (disable) any implementation
174defined special control characters
175not currently controlled by icanon,
176isig, or ixon.
177.It Cm echo Pq Fl echo
178Echo back (do not echo back) every
179character typed.
180.It Cm echoe Pq Fl echoe
181The
182.Dv ERASE
183character shall (shall
184not) visually erase the last character
185in the current line from the
186display, if possible.
187.It Cm echok Pq Fl echok
188Echo (do not echo)
189.Dv NL
190after
191.Dv KILL
192character.
193.It Cm echonl Pq Fl echonl
194Echo (do not echo)
195.Dv NL ,
196even if echo
197is disabled.
198.It Cm noflsh Pq Fl noflsh
199Disable (enable) flush after
200.Dv INTR , QUIT , SUSP .
201.It Cm control-character Ar string
202Set control-character to string.
203If string is a single character,
204the control character is set to
205that character.
206If string is the
207two character sequence "^-" or the
208string "undef" the control character
209is set to
210.Pf { Dv _POSIX_VDISABLE Ns }
211if
212it is in effect for the device; if
213.Pf { Dv _POSIX_VDISABLE Ns }
214is not in effect
215for the device, it is an
216error.
217.Pp
218Recognized control-characters:
219.Bd -ragged -offset indent
220.Bl -column character Subscript
221.It control- Ta Tn POSIX.1
222.It character	Subscript	Description
223.It _________	_________	_______________
224.It eof Ta Tn VEOF	EOF No character
225.It eol Ta Tn VEOL	EOL No character
226.It erase Ta Tn VERASE	ERASE No character
227.It intr Ta Tn VINTR	INTR No character
228.It kill Ta Tn VKILL	KILL No character
229.It quit Ta Tn VQUIT	QUIT No character
230.It susp Ta Tn VSUSP	SUSP No character
231.It start Ta Tn VSTART	START No character
232.It stop Ta Tn VSTOP	STOP No character
233.El
234.Ed
235.It Cm saved settings
236Set the current terminal
237characteristics to the saved settings
238produced by the
239.Fl g
240option.
241.It Cm min Ar number
242.It Cm time Ar number
243Set the value of min or time to
244number.
245.Dv MIN
246and
247.Dv TIME
248are used in
249Non-Canonical mode input processing
250(-icanon).
251.It Cm evenp No or Cm parity
252Enable parenb and cs7; disable
253parodd.
254.It Cm oddp
255Enable parenb, cs7, and parodd.
256.It Fl parity , evenp ,  oddp
257Disable parenb, and set cs8.
258.It Cm \&nl Pq Fl \&nl
259Enable (disable) icrnl.
260In addition
261-nl unsets inlcr and igncr.
262.It Cm ek
263Reset
264.Dv ERASE
265and
266.Dv KILL
267characters
268back to system defaults.
269.It Cm sane
270Resets all modes to reasonable values for interactive terminal use.
271.It Cm tty
272Set the line discipline to the standard terminal line discipline
273.Dv TTYDISC .
274.El
275.Pp
276The
277.Nm stty
278utility exits with a value of 0 if successful, and >0 if an error occurs.
279.Sh SEE ALSO
280.Xr stty 4
281.Sh STANDARDS
282The
283.Nm stty
284function is expected to be
285.St -p1003.2
286compatible.  The flags
287.Fl e
288and
289.Fl f
290are
291extensions to the standard.
292