xref: /openbsd/usr.bin/cu/cu.1 (revision 3bef86f7)
1.\"	$OpenBSD: cu.1,v 1.25 2023/10/03 05:20:38 jmc Exp $
2.\"
3.\" Copyright (c) 1980, 1990, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.Dd $Mdocdate: October 3 2023 $
31.Dt CU 1
32.Os
33.Sh NAME
34.Nm cu
35.Nd serial terminal emulator
36.Sh SYNOPSIS
37.Nm
38.Op Fl dr
39.Op Fl E Ar escape_char
40.Op Fl l Ar line
41.Op Fl s Ar speed | Fl Ar speed
42.Nm
43.Op Ar host
44.Sh DESCRIPTION
45.Nm
46is used to connect to another system over a serial link.
47In the era before modern networks, it was typically used to
48connect to a modem in order to dial in to a remote host.
49It is now frequently used for tasks such as attaching to the
50serial console of another machine for administrative or
51debugging purposes.
52.Pp
53The options are as follows:
54.Bl -tag -width 4n
55.It Fl d
56Specify that the line is directly connected and
57.Nm
58should not allow the driver to block waiting for a carrier to be detected.
59.It Fl E Ar escape_char
60Specify an escape character to use instead of the default tilde.
61.It Fl l Ar line
62Specify the line to use.
63Any of the forms
64.Pa cua00 ,
65.Pa /dev/cua00 ,
66or
67.Pa usb0.1.00002.3
68are permitted.
69.Pp
70The default is
71.Pa /dev/cua00 .
72See
73.Xr cua 4
74for information on terminal devices.
75Users in group
76.Dq dialer
77are permitted to use
78.Xr cua 4
79devices by default.
80.Pp
81See
82.Xr sysctl 2
83.Va hw.ucomnames
84for available USB serial lines.
85.It Fl r
86Start
87.Nm
88in restricted mode.
89This prevents all local filesystem operations
90.Po
91.Cm ~R ,
92.Cm ~X ,
93and
94.Cm ~>
95.Pc
96and command executions
97.Po
98.Cm ~C
99and
100.Cm ~$
101.Pc .
102.It Fl s Ar speed | Fl Ar speed
103Set the speed of the connection.
104The default is 9600.
105.El
106.Pp
107If
108.Ar host
109is given,
110.Nm
111uses the
112.Xr remote 5
113database to retrieve the
114.Sy dc Pq directly connected ,
115.Sy dv Pq device
116and
117.Sy br Pq baud rate
118capabilities for that host.
119The
120.Nm
121utility ignores other capabilities found in that database.
122.Pp
123Typed characters are normally transmitted directly to the remote
124machine (which does the echoing as well).
125A tilde
126.Pq Ql ~
127appearing as the first character of a line is an escape signal; the
128following are recognized:
129.Bl -tag -offset indent -width Fl
130.It Ic ~^D No or Ic ~.
131Drop the connection and exit.
132Only the connection is dropped \(en the login session is not terminated.
133.It Ic ~>
134Copy file from local to remote.
135.Nm
136prompts for the name of a local file to transmit.
137.It Ic ~$
138Pipe the output from a local
139.Ux
140process to the remote host.
141The command string sent to the local
142.Ux
143system is processed by the shell.
144.It Ic ~#
145Send a
146.Dv BREAK
147to the remote system.
148.It Ic ~^Z
149Stop
150.Nm
151(only available with job control).
152.It Ic ~C
153Fork a child process on the local system to perform special protocols
154such as XMODEM.
155The child program will be run with the following arrangement of
156file descriptors:
157.Pp
158.Bl -item -compact -offset indent
159.It
1600 \(<> remote tty in
161.It
1621 \(<> remote tty out
163.It
1642 \(<> local tty stderr
165.El
166.It Ic ~D
167Deassert the data terminal ready (DTR) line briefly.
168.It Ic ~R
169Record all output from the remote system to a file.
170If the given file already exists, it is appended to.
171If no file is specified, any existing recording is stopped.
172.It Ic ~S
173Change the speed of the connection.
174.It Ic ~X
175Send a file with the XMODEM protocol.
176.It Ic ~?
177Get a summary of the tilde escapes.
178.El
179.Pp
180When
181.Nm
182prompts for an argument, for example during setup of a file transfer,
183the line typed may be edited with the standard erase and kill characters.
184A null line in response to a prompt, or an interrupt, will abort the
185dialogue and return the user to the remote machine.
186.Pp
187.Nm
188guards against multiple users connecting to a remote system by opening
189modems and terminal lines with exclusive access.
190.Sh ENVIRONMENT
191.Bl -tag -width REMOTEXXX
192.It Ev HOST
193The default value for
194.Ar host
195if none is specified via the command line.
196.It Ev REMOTE
197A system description, or an absolute path to a
198.Xr remote 5
199system description database.
200.El
201.Sh FILES
202.Bl -tag -width /etc/remote
203.It Pa /etc/remote
204host description file
205.El
206.Sh EXIT STATUS
207.Ex -std cu
208.Sh SEE ALSO
209.Xr sysctl 2 ,
210.Xr cua 4 ,
211.Xr remote 5
212.Sh HISTORY
213The
214.Nm
215.Pq Dq Call Unix
216command first appeared outside of Bell Labs in PWB/UNIX 1.0.
217It was reimplemented as part of the
218.Nm tip
219command in
220.Bx 4.1c .
221The current version was written for
222.Ox 5.4 .
223.Sh AUTHORS
224.An Nicholas Marriott Aq Mt nicm@openbsd.org
225