[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 1

cu Command

Purpose

Connects directly or indirectly to another system.

Syntax

To Establish a Connection Using a Modem

cu-d ] [  -h ] [  -m ] [  -TSeconds ] [  -n ] [  -sSpeed ] [  -t ] [  -e | -o TelephoneNumber

To Specify the Name of a Device for a Connection

cu-d ] [  -h ] [  -m ] [  -TSeconds ] [  -sSpeed ] [  -e | -o -lLine

To Specify a System Name for a Connection

cu-d ] [  -h ] [  -m ] [  -TSeconds ] [  -e | -o ] SystemName

Description

The cu command is a Basic Networking Utilities (BNU) command that connects one system to a terminal connected to either a UNIX or non-UNIX system. The connection can be established over a hardwired line or over a telephone line using a modem.

Once the connection is established, a user can be logged in on both systems at the same time, executing commands on either one without dropping the BNU communication link. If the remote computer is also running under UNIX, the user can transfer ASCII files between the two systems.

After issuing the cu command from the local system, the user must press the Enter key and then log in to the remote system. After making the connection, the cu command runs as two concurrent processes: the transmit process reads data from standard input and, except for lines beginning with a ~ (tilde), passes that data to the remote terminal.

The receive process accepts data from the remote system and, except for lines beginning with a ~, passes it to standard output. Internally, the program accomplishes this by initiating an output diversion to a file on the local system when a line from the remote system begins with ~> (tilde, greater than). The trailing ~> marks the end of the diversion. To control input from the remote system so the buffer is not overrun, the cu command uses an automatic DC3/DC1 (Ctrl-Q/Ctrl-S) protocol.

The cu command can be used to connect multiple systems, and commands can then be executed on any of the connected systems. For example, the user can issue the cu command on system X to connect to system Y, and then issue the cu command on system Y to connect to system Z. System X is then the local computer, and systems Y and Z are remote computers.

The user can execute commands on system Z by logging in and issuing the command. Commands can be executed on system X by prefixing the command with a single tilde (~Command) and on system Y by prefixing the command with two tildes (~~Command). In general, one tilde causes the specified command to be executed on the original local computer, and two tildes cause the command to be executed on the next system on which the cu command was issued.

For example, once the multiple systems are connected, the user can execute the uname -n command (to display the node name) on systems Z, X, and Y as follows:

$ uname -n
Z
$ ~!uname -n
X
$ ~~!uname -n
Y

Notes:
  1. The cu command does not do integrity checking on data it transfers.
  2. Data fields with special cu characters may not be transmitted properly.
  3. The exit code is 0 for normal exit, otherwise, -1.

In addition to issuing regular commands on the remote system, the user can issue special cu command subcommands, which are preceded by a ~ (tilde). Use these subcommands to issue commands on the local system and to perform tasks such as transferring files between two UNIX systems. As soon as the user enters the ~!, ~$, ~%, ~l, or ~t subcommand, the system displays the name of the local computer in a format similar to the following:

~[SystemName]/%

The user then enters the subcommand to be executed on the local computer.

Flags

-d Prints diagnostic traces.
-e Designates that even parity is to be generated for data sent to the remote system.
-h Emulates local echo, supporting calls to other systems that expect terminals to be set to half-duplex mode.
-lLine Specifies the name of a device to be used as the line of communication between the local and the remote system. This can be used to override the search that would otherwise take place for the first available line with the right speed. When the -l flag is used without the -s flag, the speed of the Line is taken from the Devices file(s) (by default, the /etc/uucp/Devices file).

When the -l and -s flags are used together, the cu command searches the Devices file(s) to check whether the requested speed is available for the specified line. If so, the connection is made at the requested speed; otherwise, an error message is printed, and the call is not made.

The specified device is generally a hardwired asynchronous line (for example, /dev/tty2), in which case the TelephoneNumber parameter is not required. If the specified device is associated with a modem, a telephone number must be provided. Using this flag with the SystemName parameter rather than with TelephoneNumber parameter does not give the desired result.

Under ordinary circumstances, the user should not have to specify the transmission speed or a line or device. The defaults set when BNU is installed should be sufficient.

-m Instructs the cu command to ignore modem control signal data carrier detect (DCD).
-n For added security, prompts the user to provide the telephone number to be dialed, rather than taking it from the command line.
-o Designates that odd parity is to be generated for data sent to the remote system.
-sSpeed Specifies the rate at which data is transmitted to the remote system (300, 1200, 2400, 4800, 9600, or 19200 baud).The default value is Any speed, which instructs the system to use the rate appropriate for the default (or specified) transmission line. The order of the transmission lines is specified in the BNU Devices file(s) (by default, the /etc/uucp/Devices file). Most modems operate at 300, 1200, or 2400 baud, while most hardwired lines are set to 1200 baud or higher. When transferring data such as a file between a local and a remote system, a speed of 300 baud may occasionally be needed. The lower baud rate results in less interference on the line.
-t Used to dial an ASCII terminal that has been set to autoanswer. Appropriate mapping of carriage-return to carriage-return line feed pairs is set.
-TSeconds Specifies the maximum number of seconds to wait before timing out. The default is 45 seconds.

Note: You can also enter WAIT=n before any send string in the Dialers file. Where n is the number of seconds to wait before timing out.

Parameters

SystemName The name of the remote system, recognized by BNU, with which a connection is established. A system name can be used rather than a telephone number; in that case, the cu command obtains an appropriate hardwired line or telephone number from the BNU Systems file(s) (by default, the /etc/uucp/Systems file). System names must be ASCII characters only.

Note: Do not use the SystemName flag with the -l flag and the -s flag. If you do, the cu command connects to the first available line for the requested system name, ignoring the specified line and speed.
TelephoneNumber The telephone number used to establish a remote connection using a modem. This entry can be either a local or a long-distance telephone number.

Subcommands

The cu command transmit process interprets lines beginning with a ~ (tilde) in the following ways:

~! Returns the user to an interactive shell on the local system. Toggle between the local and remote systems using ~! (remote to local) and Ctrl-D (local to remote).
~%break Transmits a break sequence to the remote system. The break can also be specified as ~%b.
~%cd DirectoryName Changes the directory on the local system from the current directory to the directory specified by the DirectoryName variable.
~%debug Toggles the -debug flag on or off; this can also be specified as ~%d.
~%nostop Toggles between DC3/DC1 input control protocol and no input control. This is useful in case the remote system is one that does not respond properly to the DC3 and DC1 characters.
~%put From [ To ] Copies the From file on the local system to the To file on the remote system. If the To variable is omitted, the local file is copied to the remote system under the same file name. As each block of the file is transferred, consecutive single digits are displayed on the terminal screen. Only ASCII files can be transferred using this subcommand.

The use of the ~%put subcommand requires the stty command and the cat command on the remote system. It also requires that the current erase and kill characters on the remote system be identical to these current control characters on the local system. Backslashes are inserted at appropriate places in the transmitted data. There is an artificial slowing of transmission by the cu command during the ~%put operation so that loss of data is unlikely.

~%take From [ To ] Copies the From file on the remote system to the To file on the local system. If the To variable is omitted, the remote file is copied to the local system under the same file name. As each block of the file is transferred, consecutive single digits are displayed on the terminal screen. Only ASCII files can be transferred using this subcommand. The use of the ~%take subcommand requires the echo command and the cat command on the remote system. Also, stty tabs mode should be set on the remote system if tabs are to be copied without expansion to spaces.
~. Logs the user off the remote computer and then terminates the remote connection. Usually the connection terminates when you log off the remote computer. However, with some types of interconnection hardware, it may be necessary to use a ~. to terminate the conversation after the normal logoff sequence has been used.
~!Command Executes, on the local system, the command denoted by the Command variable.
~$Command Runs, on the local system, the command denoted by the Command variable, then sends the command's output to the remote system for execution.
~l Prints the values of the TERMIO structure variables for the remote communication line. This is useful for debugging.
~t Prints the values of the TERMIO structure variables for the user's terminal. This is useful for debugging.
~~String Sends the string denoted by the String variable to the remote system.

Examples

The following are examples of connecting to a remote system.

  1. To connect to a remote system, enter:

    cu venus

    In this example, you are connected to the remote system venus. System venus must be listed in one of the local Systems files (by default, the /etc/uucp/Systems file or one of the Systems files listed for the cu command in the /etc/uucp/Sysfiles file).

  2. To dial a remote system and set the baud rate, enter:
    cu  -s1200 9=12015558391
    In this example, you dial a remote system whose telephone number is 1-201-555-8391, where dialing 9 is required to get an outside dial tone. The baud rate is set to 1200.
  3. To log in to a system connected by a hardwired line asynchronous line, enter:
    cu  -l /dev/tty2
    The cu command contacts the system connected to the tty2 device.
  4. To dial a remote system with a specified line and a specific speed, enter:
    cu  -s 1200  -l tty3
    The command contacts the system connected to the tty3 device, using a speed of 1200 baud.
  5. To dial a remote system using a specific line associated with a modem, enter:
    cu  -l cul4 9=12015558391
    In this example, you dial a remote system whose telephone number is 1-201-555-8391, where dialing 9 is required to get an outside dial tone. The cu command uses the modem connected to the cul4 device.
  1. To display the contents of a file after logging in to the remote system, enter:
    ~!pg /usr/msg/memos/file10
    The ~! subcommand executes the pg command on the local system, displaying the contents of the file10 file in the /usr/msg/memos directory on the local system.
  2. To copy a file from the local system to the remote system without changing the name of the file, enter:
    ~%put /home/amy/file
    The /home/amy/file file is copied from the local system to the remote system without changing the name of the file.
  3. To copy a file from the local system to the remote system and change the file name, enter:
    ~%put /home/amy/file /home/amy/tmpfile
    The /home/amy/file file is copied from the local system to the remote system and the file name changed to /home/amy/tmpfile.
  4. To copy a file from the remote system to the local system without changing the name of the file, enter:
    ~%take /home/jeanne/test1
    The /home/jeanne/test1 file is copied from the remote system to the local system without changing the name of the file.
  5. To copy a file from the remote system to the local system and change the file name, enter:
    ~%take /home/jeanne/test1 /usr/dev/jeanne/tmptest
    In this example, the /home/jeanne/test1 file is copied from the remote system to the local system and the file name changed to /usr/dev/jeanne/tmptest.

Files

/etc/locks Prevents multiple use of device.
/usr/bin/cu Specifies the path name of the cu command.
/bin/cu Specifies a symbolic link to the /usr/bin/cu command.
/etc/uucp/Devices Contains information about available links.
/etc/uucp/Dialcodes Contains dialing code abbreviations.
/etc/uucp/Dialers Controls initial handshaking on a link.
/etc/uucp/Permissions Contains access permission codes.
/etc/uucp/Systems Lists accessible remote systems.
/etc/uucp/Sysfiles Specifies alternate files to be used as Systems, Devices, and Dialers files.

Related Information

The cat command, ct command, echo command, rmail command, stty command, uname command, uucp command, uuname command, uupick command, uustat command, uuto command, uux command.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]