cu(1bnu)
cu --
call another UNIX system
Synopsis
cu [options] [destination]
Description
The cu command calls up another UNIX system,
a terminal, or possibly a non-UNIX system.
It manages an interactive conversation with possible
transfers of files.
Options
cu takes the following options.
The -c, -l, and -s
options play a part in selecting the medium;
the remaining options are used in configuring the line.
-b n-
Force the number of bits processed on the line to be n, where
n can be either 7 or 8.
This allows connection between
systems with different character sizes.
By default, the
character size of the line
is set to the value specified by the CHARSIZE parameter
in the Config file (see
Config(4bnu)).
If no CHARSIZE value is specified in the Config file,
the character size of the line
is set to the same as the current local terminal.
For example,
if no CHARSIZE value is specified,
and you are using an 8-bit system
to call a 7-bit system,
cu assumes the system you want to call
is another 8-bit system;
unless otherwise specified
with the -b 7 on the cu command line.
If CHARSIZE is set to 7 in the Config file,
and you want cu to call an 8-bit system,
you would specify -b 8 on the cu command line
to override both the CHARSIZE value and the local terminal setting.
-c type-
Force cu to only use entries in the
Devices(4bnu)
file
having a value in the ``Type'' field
that match type.
Typically, type specifies the name of a local area network.
-d-
Enable debugging.
This option logs diagnostic information for both
the conversation phase and the connection phase.
Output is sent to the terminal screen.
-e-
Set an even data parity.
This option forces cu to generate an even parity
during data transmission.
By default,
cu uses the value specified by the PARITY parameter
in the Config file
to establish the parity for data sent to the remote system
(see
Config(4bnu)).
By default, the PARITY parameter
is set to the local terminal setting.
-h-
Set communication mode to half-duplex.
This option echoes characters locally
to support calls to other computer systems
that expect terminals to be set to half-duplex mode.
-l line-
Specify a device name to use as the communication line.
This option can be used to override the search
that would otherwise take place
for the first available line having the right speed.
When the -l option is used without the -s option,
the speed of the line is taken from the Devices file entry
having a value in the ``Line'' field
that matches the device name line
(see
Devices(4bnu)).
When the -l and -s options are used together,
cu searches the Devices file
to check if the requested speed for the requested line is available.
If available, the connection is made at the
requested speed, otherwise, an error message is printed and the call
is not made.
In the general case where a specified device is a directly connected
asynchronous line (for example, /dev/term/ab),
a telephone number is not required.
The specified device need not be in the /dev directory.
If the specified device is associated with an auto dialer,
the destination argument must specify a telephone number.
-n-
Request user prompt for telephone number.
For added security, this option
will prompt the user to provide the telephone number to be dialed, rather than
taking it from the command line.
-o-
Set an odd data parity.
This option forces cu to generate an odd parity
during data transmission.
By default,
cu uses the value specified by the PARITY parameter
in the Config file to establish the parity
for data sent to the remote system
(see
Config(4bnu)).
By default, the PARITY parameter
is set to the local terminal setting.
-p-
Set data parity to none.
This option forces cu to generate a none parity
during data transmission.
By default,
cu uses the value specified by the PARITY parameter
in the Config file to establish the parity
for data sent to the remote system
(see
Config(4bnu)).
By default, the PARITY parameter
is set to the local terminal setting.
-s speed-
Specify the transmission speed (300, 1200, 2400, 4800 or 9600).
The default value is Any,
which will depend on the order of the
lines in the
Devices(4bnu)
file.
Most modems are either 2400bps or 9600bps.
Directly connected lines may be set to speeds higher than 2400bps.
-t-
Set an appropriate mapping of carriage-return
to carriage-return-line-feed pairs.
This option is used to dial a terminal
which has been set to auto answer.
-x-
Use chat scripts. By default, cu does not
use chat scripts.
Connection phase
cu uses the same mechanism as
uucp
to establish a connection.
This means that it uses the control files
/etc/uucp/Devices (see
Devices(4bnu))
and /etc/uucp/Systems (see
Systems(4bnu)).
This gives cu the ability to choose from several different media
to establish the connection.
The possible media include telephone lines, direct connections,
and local area networks (LANs).
The Devices file contains a list of media
that are available on your system.
The Systems file contains information
for connecting to remote systems, but is not generally readable.
The destination argument lets cu know what system you
wish to connect to.
destination can be blank, a telephone number, a
system name, or a LAN-specific address.
A telephone number is a string consisting of the tone dial
characters (the digits 0 through 9, ``'', and ``#'') plus
the special characters ``='' and ``-''.
The equal sign designates a secondary dial tone and the minus sign
creates a 4 second delay.
A system name is the name of any computer that uucp can call;
the uuname command (see
uucp(1bnu))
prints a list of these names.
The documentation for your LAN will show the form of the LAN-specific
address.
If cu's default behavior is invoked
(that is, if you do not use the -c or -l options),
cu uses destination
to determine which medium to use.
If destination is a telephone number,
then cu assumes that you want to use a telephone
line and it selects an automatic call unit (ACU).
If destination is not a telephone number,
then cu assumes that it is a system name.
In this case,
cu follows the uucp calling mechanism and uses the
Systems and Devices
files to obtain the best available connection.
Since cu chooses a speed that is appropriate for
the medium that it selects, you may not use the
-s option when destination is a system name.
The -c and -l options modify this default behavior.
-c is most often used to select a LAN
by specifying a ``Type'' field from the Devices file.
Here, destination is assumed to be a system name.
If the connection attempt to this system name
fails, a connection will be attempted using destination
as a LAN-specific address.
The -l option is used
to specify a device associated with a direct connection.
If the connection is truly a direct connection to the remote machine,
then there is no need to specify destination.
This is the only case when a blank destination is allowed.
On the other hand, there may be cases in which the specified device
connects to a dialer, so it is valid to specify a telephone number as
destination.
The -c and -l
options should not be specified together on the command line.
Conversation phase
After making the connection,
cu
runs as two processes:
the
transmit
process reads data from the standard input and,
except for lines beginning with a tilde (~),
passes them to the remote system;
the
receive
process accepts data from the remote system and,
except for lines beginning with
a tilde,
passes them to the standard output.
Normally, an automatic DC3/DC1 protocol
is used to control input from the remote so that the buffer is
not overrun.
Lines beginning with a tilde have special meanings.
The
transmit
process interprets the following user-initiated commands:
~.-
terminate the conversation.
Note that, until the connection is established,
attempting to use ~. to terminate the conversation
will have no effect.
~!-
escape to an interactive shell on the local system.
~!cmd...-
run cmd on the local system
(via
sh -c).
~$cmd...-
run cmd locally and send its output
to the remote system.
~+cmd...-
run cmd locally and connect its input and output
to the remote system.
~%cd-
change the directory on the local system.
Note that ~!cd will cause the command to be run by a sub-shell.
~%take from [to]-
copy file from (on the remote system) to file
to on the local system.
If to is omitted, the from
argument is used in both places.
~%put from [to]-
copy file from (on local system) to file
to on the remote system.
If to is omitted, the from
argument is used in both places.
~~line-
send the line ~line
to the remote system.
~%break-
transmit a BREAK
to the remote system (which can also be specified as ~%b).
~%debug-
toggle the
-d
debugging option on or off (which can also be specified as ~%d).
~t-
print the values of the termio structure variables for the user's
terminal (useful for debugging).
~l-
print the values of the termio structure variables for the remote
communication line (useful for debugging).
~%ifc-
toggle between DC3/DC1
input control protocol and no input control.
This is useful when the remote system does
not respond properly to the DC3 and DC1 characters.
(this can also be specified as ~%nostop).
~%ofc-
toggle the output flow control setting.
When enabled, outgoing data flow may be controlled
by the remote host (this can also be specified
as ~%noostop).
~%divert-
allow/disallow unsolicited diversions.
That is, diversions not specified by ~%take.
~%old-
allow/disallow old style syntax for received diversions.
The
receive
process normally copies data from the remote system to the standard
output of the local system.
It may also direct the output to local files.
The use of
~%put
requires
stty(1)
and
cat(1)
on the remote side.
It also requires that the
current control characters on the remote
system be identical to the current control
characters on the local system.
Backslashes are inserted at appropriate places
for these control characters.
The use of
~%take
requires the existence of
echo(1)
and
cat(1)
on the remote system.
Also,
tabs
mode (see
stty(1))
should be set on the remote system if
tabs are to be copied without expansion to spaces.
When
cu
is used on system sysX to connect to system sysY and
subsequently used on system sysY to connect to
system sysZ, commands on system Y can be executed
by using ~~.
Executing a tilde command reminds the user
of the local system uname.
For example, uname can be executed
on sysZ, sysX, and sysY as follows:
uname
sysZ
~[sysX]!uname
sysX
~~[sysY]!uname
sysY
In general,
~
causes the command to be executed on the original machine.
~~
causes the command to be executed on the next machine in
the chain.
Files
/etc/uucp/Config-
/etc/uucp/Devices-
/etc/uucp/Sysfiles-
/etc/uucp/Systems-
/var/spool/locks/*-
Usage
It is convenient to think of cu as operating in two phases.
The first phase is the connection phase in which the connection is
established.
cu then enters the conversation phase.
The cu command sets the input and output
conversion mode to on or off, as appropriate,
to avoid a character conversion on the local system when
accessing the remote system.
On the remote
system, the input and output conversion should be set manually,
as cu cannot know whether input conversion is required or not.
In most cases, remote
systems can be used with input conversion switched on;
however, when transferring files,
this should be switched off before invoking the file transfer command
in order to avoid unexpected conversion of the file contents.
Diagnostics
Exit code is zero for normal exit,
otherwise, one.
Warnings
You cannot use cu to log in as root
if root's login shell on the remote system is set to
sh(1).
The cu command
does not perform any integrity checking on data it transfers.
Data fields with special
cu
characters may not be transmitted properly.
Depending on the interconnection hardware,
it may be necessary to use a ~.
to terminate the conversion, even if
stty 0
has been used.
Non-printing characters are not dependably transmitted using either
the ~%put or ~%take commands.
cu
will not return a login prompt immediately upon connection,
when used between an IMBR1 and a PENRIL modem.
A carriage return will return the prompt.
~%put and ~%take cannot be used
over multiple links.
Files must be moved
one link at a time.
If cu is invoked without the -b option
from the command line in an Xterm window, then problems may occur
and ~%take may fail.
There is an artificial slowing of transmission by
cu
during the
~%put
operation so that loss of data is unlikely.
Files transferred using ~%take or ~%put must contain
a trailing newline, otherwise the
operation will hang.
Entering <Ctrl>d usually clears the
hang condition.
Examples
To dial a system whose telephone number is 9 1 201 555 1234 using 1200 baud
(where dialtone is expected after the 9):
cu -s 1200 9=12015551234
If the speed is not specified, Any is the default value.
To log onto a system that is on a Datakit VCS local area network, but
which has not been defined
in the Systems file:
cu -c dk address
where dk
is the name of the Datakit local area network, and
address
is the Datakit address which is of the form:
/area/exchange/machine
To log onto a system connected by a direct line:
cu -l /dev/term/XX
or
cu -l term/XX
To dial a system with a specific line and speed:
cu -s 1200 -l term/XX
To dial a system using a specific line associated with an auto dialer:
cu -l culXX 9=12015551234
To use a system name:
cu systemname
References
cat(1),
Config(4bnu),
cs(1Mbnu),
ct(1bnu),
Devices(4bnu),
echo(1),
Permissions(4bnu),
stty(1),
Systems(4bnu),
Sysfiles(4bnu),
uname(1),
uucp(1bnu)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004