xref: /openbsd/usr.bin/cu/cu.1 (revision 3cab2bb3)
1.\"	$OpenBSD: cu.1,v 1.20 2020/02/08 01:09:57 jsg 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: February 8 2020 $
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.
63Either of the forms like
64.Pa cua00
65or
66.Pa /dev/cua00
67are permitted.
68The default is
69.Pa /dev/cua00 .
70See
71.Xr cua 4
72for information on terminal devices.
73Users in group
74.Dq dialer
75are permitted to use
76.Xr cua 4
77devices by default.
78.It Fl r
79Start
80.Nm
81in restricted mode.
82This prevents all local filesystem operations
83.Po
84.Cm ~R ,
85.Cm ~X ,
86and
87.Cm ~>
88.Pc
89and command executions
90.Po
91.Cm ~C
92and
93.Cm ~$
94.Pc .
95.It Fl s Ar speed | Fl Ar speed
96Set the speed of the connection.
97The default is 9600.
98.El
99.Pp
100If
101.Ar host
102is given,
103.Nm
104uses the
105.Xr remote 5
106database to retrieve the
107.Sy dc Pq directly connected ,
108.Sy dv Pq device
109and
110.Sy br Pq baud rate
111capabilities for that host.
112The
113.Nm
114utility ignores other capabilities found in that database.
115.Pp
116Typed characters are normally transmitted directly to the remote
117machine (which does the echoing as well).
118A tilde
119.Pq Ql ~
120appearing as the first character of a line is an escape signal; the
121following are recognized:
122.Bl -tag -offset indent -width Fl
123.It Ic ~^D No or Ic ~.
124Drop the connection and exit.
125Only the connection is dropped \(en the login session is not terminated.
126.It Ic ~>
127Copy file from local to remote.
128.Nm
129prompts for the name of a local file to transmit.
130.It Ic ~$
131Pipe the output from a local
132.Ux
133process to the remote host.
134The command string sent to the local
135.Ux
136system is processed by the shell.
137.It Ic ~#
138Send a
139.Dv BREAK
140to the remote system.
141.It Ic ~^Z
142Stop
143.Nm
144(only available with job control).
145.It Ic ~C
146Fork a child process on the local system to perform special protocols
147such as XMODEM.
148The child program will be run with the following arrangement of
149file descriptors:
150.Bd -literal -offset indent
1510 <-> remote tty in
1521 <-> remote tty out
1532 <-> local tty stderr
154.Ed
155.It Ic ~D
156Deassert the data terminal ready (DTR) line briefly.
157.It Ic ~R
158Record all output from the remote system to a file.
159If the given file already exists, it is appended to.
160If no file is specified, any existing recording is stopped.
161.It Ic ~S
162Change the speed of the connection.
163.It Ic ~X
164Send a file with the XMODEM protocol.
165.It Ic ~?
166Get a summary of the tilde escapes.
167.El
168.Pp
169When
170.Nm
171prompts for an argument, for example during setup of a file transfer,
172the line typed may be edited with the standard erase and kill characters.
173A null line in response to a prompt, or an interrupt, will abort the
174dialogue and return the user to the remote machine.
175.Pp
176.Nm
177guards against multiple users connecting to a remote system by opening
178modems and terminal lines with exclusive access.
179.Sh ENVIRONMENT
180.Bl -tag -width REMOTEXXX
181.It Ev HOST
182The default value for
183.Ar host
184if none is specified via the command line.
185.It Ev REMOTE
186A system description, or an absolute path to a
187.Xr remote 5
188system description database.
189.El
190.Sh FILES
191.Bl -tag -width /etc/remote
192.It Pa /etc/remote
193host description file
194.El
195.Sh EXIT STATUS
196.Ex -std cu
197.Sh SEE ALSO
198.Xr remote 5
199.Sh HISTORY
200The
201.Nm
202command appeared in
203.At v7 .
204This version was written for
205.Ox 5.4
206by Nicholas Marriott.
207