cu
Call other systems using a serial port
TLDR
Open a given serial port
Open a given serial port with a given baud rate
Open a given serial port with a given baud rate and echo characters locally (half-duplex mode)
Open a given serial port with a given baud rate, parity, and no hardware or software flow control
Exit the cu session when in connection
Display help
SYNOPSIS
cu [options] [system-name | phone-number]
cu -l line [-s speed] [options]
PARAMETERS
-l line
Specifies the communication line or device to use, e.g., /dev/ttyS0 for a serial port or network!host for network connections.
-s speed
Sets the transmission speed (baud rate) for the connection, such as 9600 or 115200.
-e
Enables even parity for the data transmission.
-o
Enables odd parity for the data transmission.
-n
Prompts the user for a phone number to dial instead of taking it from the command line.
-t
Indicates a 'direct' connection (hardwired), typically used for null-modem cables or direct serial console access without modem dialing.
-h
Sets half-duplex mode, meaning characters are not echoed locally and must be echoed by the remote system.
-x debug_level
Sets the debugging level for output, useful for troubleshooting connection issues.
DESCRIPTION
The cu (call up) command is a utility for connecting to other systems, typically via a serial port (like a modem or a direct null-modem cable) or, less commonly today, a network connection. It's a foundational part of the older UUCP (Unix-to-Unix Copy Program) suite, though it can operate independently.
While largely superseded by more modern terminal emulators like minicom or screen for general serial console access, cu remains valuable for its simplicity and directness. It allows users to establish a terminal connection, send and receive data, and even transfer files (using internal escape sequences or external programs like kermit or xmodem via shell escapes). Its primary use cases include interacting with network equipment via console ports, configuring modems, or establishing point-to-point data links between two Unix-like systems.
CAVEATS
The cu command, while simple, has several considerations:
- Device Permissions: The user running cu must have appropriate read and write permissions to the serial device (e.g., /dev/ttyS0). This often means being a member of the dialout or uucp group.
- Configuration Files: When connecting by system name or phone number, cu relies on UUCP configuration files like /etc/uucp/Systems and /etc/uucp/Devices. These files might not be present or correctly configured on modern Linux distributions, making the -l (line) option more common for direct serial access.
- Escape Sequences: To perform actions like disconnecting, executing local commands, or transferring files, cu uses special escape sequences (e.g., ~. to quit). Forgetting these can make it seem like the session is hung.
- Feature Set: It offers a much more basic feature set compared to modern terminal emulators like minicom or screen, lacking robust scripting, log file capabilities, or extensive file transfer protocols built-in (though external programs can be invoked).
COMMON ESCAPE SEQUENCES
While connected, cu interprets lines beginning with a tilde (~) as escape sequences, allowing control over the session:
- ~.
Terminates the connection and exits cu. (The most important one!) - ~!
Escapes to a local shell. Type exit to return to the cu session. - ~$
Executes a local command and sends its output to the remote system. For example, ~$ ls would send a directory listing to the remote system. - ~%take from [to]
Receives a file from the remote system. - ~%put from [to]
Sends a file to the remote system.
TYPICAL USAGE EXAMPLE
To connect to a device on a serial port (e.g., /dev/ttyUSB0) at a specific baud rate (e.g., 115200):
cu -l /dev/ttyUSB0 -s 115200
This is the most common modern use case for directly interacting with serial consoles.
HISTORY
The cu command originated as a core component of the UUCP (Unix-to-Unix Copy Program) suite, which was developed at AT&T Bell Labs in the late 1970s and early 1980s. UUCP provided a means for Unix systems to communicate and transfer files over telephone lines and later, early networks. cu's role was specifically to establish interactive terminal sessions. While UUCP's prominence waned with the widespread adoption of TCP/IP and the internet, cu has persisted in various Unix and Linux distributions. Its continued relevance is primarily in niche areas such as interacting with embedded systems, network devices, and industrial control systems via their serial console ports, where its simplicity and directness are often preferred.