CU(1) | General Commands Manual | CU(1)

# NAME

`cu` — serial terminal emulator

# SYNOPSIS

`cu` | [`-dr`] [`-E` escape_char] [`-l` line] [`-s` speed | `-`speed]

`cu` | [host]

# DESCRIPTION

`cu` is used to connect to another system over a serial link. In the era before modern networks, it was typically used to connect to a modem in order to dial in to a remote host. It is now frequently used for tasks such as attaching to the serial console of another machine for administrative or debugging purposes.

The options are as follows:

`-d`
  Specify that the line is directly connected and `cu` should not allow the driver to block waiting for a carrier to be detected.
`-E` escape_char
  Specify an escape character to use instead of the default tilde.
`-l` line
  Specify the line to use. Any of the forms cua00, /dev/cua00, or usb0.1.00002.3 are permitted.

  The default is /dev/cua00. See cua(4) for information on terminal devices. Users in group “dialer” are permitted to use cua(4) devices by default.

  See sysctl(2) hw.ucomnames for available USB serial lines.

`-r`
  Start `cu` in restricted mode. This prevents all local filesystem operations (`~R`, `~X`, and `~>`) and command executions (`~C` and `~$`).
`-s` speed | `-`speed
  Set the speed of the connection. The default is 9600.

If host is given, `cu` uses the remote(5) database to retrieve the dc (directly connected), dv (device) and br (baud rate) capabilities for that host. The `cu` utility ignores other capabilities found in that database.

Typed characters are normally transmitted directly to the remote machine (which does the echoing as well). A tilde (‘`~`’) appearing as the first character of a line is an escape signal; the following are recognized:

`~^D` or `~.`
  Drop the connection and exit. Only the connection is dropped – the login session is not terminated.
`~>`
  Copy file from local to remote. `cu` prompts for the name of a local file to transmit.
`~$`
  Pipe the output from a local UNIX process to the remote host. The command string sent to the local UNIX system is processed by the shell.
`~#`
  Send a `BREAK` to the remote system.
`~^Z`
  Stop `cu` (only available with job control).
`~C`
  Fork a child process on the local system to perform special protocols such as XMODEM. The child program will be run with the following arrangement of file descriptors:

  - 0 ↔ remote tty in
  - 1 ↔ remote tty out
  - 2 ↔ local tty stderr
`~D`
  Deassert the data terminal ready (DTR) line briefly.
`~R`
  Record all output from the remote system to a file. If the given file already exists, it is appended to. If no file is specified, any existing recording is stopped.
`~S`
  Change the speed of the connection.
`~X`
  Send a file with the XMODEM protocol.
`~?`
  Get a summary of the tilde escapes.

When `cu` prompts for an argument, for example during setup of a file transfer, the line typed may be edited with the standard erase and kill characters. A null line in response to a prompt, or an interrupt, will abort the dialogue and return the user to the remote machine.

`cu` guards against multiple users connecting to a remote system by opening modems and terminal lines with exclusive access.

# ENVIRONMENT

`HOST`
  The default value for host if none is specified via the command line.
`REMOTE`
  A system description, or an absolute path to a remote(5) system description database.

# FILES

/etc/remote
  host description file

# EXIT STATUS

The `cu` utility exits 0 on success, and >0 if an error occurs.

# SEE ALSO

sysctl(2), cua(4), remote(5)

# HISTORY

The `cu` (“Call Unix”) command first appeared outside of Bell Labs in PWB/UNIX 1.0. It was reimplemented as part of the `tip` command in 4.1cBSD. The current version was written for OpenBSD 5.4.

# AUTHORS

Nicholas Marriott <nicm@openbsd.org>

October 3, 2023 | Debian