CU(1)                      OpenBSD Reference Manual                      CU(1)

NAME
     cu - serial terminal emulator

SYNOPSIS
     cu [-ehot] [-a acu] [-l line] [-s speed | -speed] [phone-number]

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 adminis-
     trative or debugging purposes.

     The options are as follows:

     -a acu
           Set the acu.

     -e    Use even parity.  If both -e and -o are given, then no parity is
           used (the default).

     -h    Echo characters locally (half-duplex mode).

     -l line
           Specify the line to use.  Either of the forms like tty00 or
           /dev/tty00 are permitted.

           For reasons outlined in tty(4), cua(4) devices should be used on
           architectures which have them.  For those which do not, tty(4) de-
           vices can be used.  Users in group ``dialer'' are permitted to use
           cua(4) devices by default; permissions on /dev/tty00 or /dev/ttya
           can be changed, but they will revert to their defaults after an up-
           grade or (re)install.

     -o    Use odd parity.  If both -e and -o are given, then no parity is
           used (the default).

     -s speed | -speed
           Set the speed of the connection.  The default is 9600.

     -t    Connect via a hard-wired connection to a host on a dial-up line.

     Line access is logged to /var/log/aculog.  This file does not exist by
     default and has to be created to enable logging.

     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.

           ~c [name]   Change directory to name (no argument implies change to
                       home directory).

           ~!          Escape to a shell (exiting the shell will return to
                       cu).

           ~>          Copy file from local to remote.  cu prompts for the
                       name of a local file to transmit.

           ~<          Copy file from remote to local.  cu prompts first for
                       the name of the file to be sent, then for a command to
                       be executed on the remote machine.

           ~p from [to]
                       Send a file to a remote UNIX host.  This command causes
                       the remote UNIX system to run the following command
                       string, sending it the `from' file:

                             stty -echo; cat > 'to'; stty echo

                       If the `to' file isn't specified, the `from' file name
                       is used.  This command is actually a UNIX specific ver-
                       sion of the ~> command.

           ~t from [to]
                       Take a file from a remote UNIX host.  As in the ~p com-
                       mand, the `to' file defaults to the `from' file name if
                       it isn't specified.  The remote host executes the fol-
                       lowing command string to send the file to cu:

                             cat 'from'; echo '' | tr '\012' '\01'

           ~|          Pipe the output from a remote command to a local UNIX
                       process.  The command string sent to the local UNIX
                       system is processed by the shell.

           ~$          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.

           ~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 de-
                       scriptors:

                             0 <-> remote tty in
                             1 <-> remote tty out
                             2 <-> local tty stderr

           ~#          Send a BREAK to the remote system.  For systems which
                       don't support the necessary ioctl() call, the break is
                       simulated by a sequence of line speed changes and DEL
                       characters.

           ~s          Set a variable (see the discussion below).

           ~v          List all variables and their values (if set).

           ~^Z         Stop cu (only available with job control).

           ~^Y         Stop only the ``local side'' of cu (only available with
                       job control); the ``remote side'' of cu, the side that
                       displays output from the remote host, is left running.

           ~?          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, and by honoring the
     locking protocol used by uucico.

     During file transfers cu provides a running count of the number of lines
     transferred.  When using the ~> and ~< commands, the ``eofread'' and
     ``eofwrite'' variables are used to recognize end-of-file when reading,
     and specify end-of-file when writing (see below).  File transfers normal-
     ly depend on hardwareflow or tandem mode for flow control.  If the remote
     system does not support hardwareflow or tandem mode, ``echocheck'' may be
     set to indicate cu should synchronize with the remote system on the echo
     of each transmitted character.

     When cu must dial a phone number to connect to a system, it will print
     various messages indicating its actions.  cu supports a variety of auto-
     call units and modems with the at capability in system descriptions.

     Support for Ventel 212+ (ventel), Hayes AT-style (hayes), USRobotics
     Courier (courier), Telebit T3000 (t3000) and Racal-Vadic 831 (vadic)
     units is enabled by default.

     Support for Bizcomp 1031[fw] (biz31[fw]), Bizcomp 1022[fw] (biz22[fw]),
     DEC DF0[23]-AC (df0[23]), DEC DN-11 (dn11) and Racal-Vadic 3451 (v3451)
     units can be added by recompiling cu with the appropriate defines.

     Note that if support for both the Racal-Vadic 831 and 3451 is enabled,
     they are referred to as the v831 and v3451 respectively.  If only one of
     the two is supported, it is referred to as vadic.

   VARIABLES
     cu maintains a set of variables which control its operation.  Some of
     these variables are read-only to normal users (root is allowed to change
     anything of interest).  Variables may be displayed and set through the
     `s' escape.  The syntax for variables is patterned after vi(1) and
     Mail(1).  Supplying ``all'' as an argument to the set command displays
     all variables readable by the user.  Alternatively, the user may request
     display of a particular variable by attaching a `?' to the end.  For ex-
     ample, ``escape?'' displays the current escape character.

     Variables are numeric, string, character, or boolean values.  Boolean
     variables are set merely by specifying their name; they may be reset by
     prepending a `!' to the name.  Other variable types are set by concate-
     nating an `=' and the value.  The entire assignment must not have any
     blanks in it.  A single set command may be used to interrogate as well as
     set a number of variables.  Certain common variables have abbreviations.
     The following is a list of common variables, their abbreviations, and
     their default values:

     baudrate      (num) The baud rate at which the connection was estab-
                   lished; abbreviated ba.

     beautify      (bool) Discard unprintable characters when a session is be-
                   ing scripted; abbreviated be.

     dialtimeout   (num) When dialing a phone number, the time (in seconds) to
                   wait for a connection to be established; abbreviated dial.

     echocheck     (bool) Synchronize with the remote host during file trans-
                   fer by waiting for the echo of the last character transmit-
                   ted; default is off.

     eofread       (str) The set of characters which signify an end-of-trans-
                   mission during a ~< file transfer command; abbreviated
                   eofr.

     eofwrite      (str) The string sent to indicate end-of-transmission dur-
                   ing a ~> file transfer command; abbreviated eofw.

     eol           (str) The set of characters which indicate an end-of-line.
                   cu will recognize escape characters only after an end-of-
                   line.

     escape        (char) The command prefix (escape) character; abbreviated
                   es; default value is `~'.

     exceptions    (str) The set of characters which should not be discarded
                   due to the beautification switch; abbreviated ex; default
                   value is ``\t\n\f\b''.

     force         (char) The character used to force literal data transmis-
                   sion; abbreviated fo; default value is `^P'.

     framesize     (num) The amount of data (in bytes) to buffer between
                   filesystem writes when receiving files; abbreviated fr.

     hardwareflow  (bool) Whether hardware flow control (CRTSCTS) is enabled
                   for the connection; abbreviated hf; default value is `off'.

     host          (str) The name of the host to which you are connected; ab-
                   breviated ho.

     linedisc      (num) The line discipline to use; abbreviated ld.

     prompt        (char) The character which indicates an end-of-line on the
                   remote host; abbreviated pr; default value is `\n'.  This
                   value is used to synchronize during data transfers.  The
                   count of lines transferred during a file transfer command
                   is based on receipt of this character.

     raise         (bool) Upper case mapping mode; abbreviated ra; default
                   value is off.  When this mode is enabled, all lowercase
                   letters will be mapped to uppercase by cu for transmission
                   to the remote machine.

     raisechar     (char) The input character used to toggle uppercase mapping
                   mode; abbreviated rc; default value is `^A'.

     record        (str) The name of the file in which a session script is
                   recorded; abbreviated rec.

     script        (bool) Session scripting mode; abbreviated sc; default is
                   off.  When script is true, cu will record everything trans-
                   mitted by the remote machine in the script record file
                   specified in record.  If the beautify switch is on, only
                   printable ASCII characters will be included in the script
                   file (those characters between 040 and 0177).  The variable
                   exceptions is used to indicate characters which are an ex-
                   ception to the normal beautification rules.

     tabexpand     (bool) Expand tabs to spaces during file transfers; abbre-
                   viated tab; default value is false.  Each tab is expanded
                   to 8 spaces.

     tandem        (bool) Use XON/XOFF flow control to throttle data from the
                   remote host; abbreviated ta.  The default value is true.

     verbose       (bool) Verbose mode; abbreviated verb; default is true.
                   When verbose mode is enabled, cu prints messages while di-
                   aling, shows the current number of lines transferred during
                   a file transfer operations, and more.

ENVIRONMENT
     HOME        The home directory to use for the ~c command.

     SHELL       The name of the shell to use for the ~! command; default val-
                 ue is ``/bin/sh''.

FILES
     /var/log/aculog         line access log
     /var/spool/lock/LCK..*  lock file to avoid conflicts with uucp

SEE ALSO
     tip(1)

HISTORY
     The cu command appeared in 4.2BSD.

BUGS
     The full set of variables is undocumented and should, probably, be pared
     down.

OpenBSD 4.6                     January 9, 2009                              5
