rz
Receive files via Zmodem protocol
SYNOPSIS
rz [options]
PARAMETERS
-a
Convert received files to text (strip eighth bit).
-b
Perform binary transfer (default).
-B NUM
Set buffer size to NUM Kbytes.
-c
Enable crash recovery, allowing resumption of interrupted transfers.
-C
Don't escape control characters (raw data output).
-D
Output debugging information.
-E
Escape all control characters except CR, LF, XON, XOFF.
-e
Escape all control characters.
-i
Ignore CRC errors during transfer.
-k
Kill (remove) any existing file with the same name before transfer.
-L NUM
Limit length of received pathnames to NUM characters.
-m
Don't clobber existing files (skip if file with same name exists).
-o
Use old Zmodem protocol (for compatibility with older systems).
-p
Preserve file attributes (modification time, access time, mode) of received files.
-q
Run in quiet mode (suppress verbose output).
-r
Use raw mode (no escape for any characters).
-R
Receive files and write their content to standard output.
-s
Receive Zmodem data from standard input and write the reconstructed file to standard output (stream transfer).
-S NUM
Set a general timeout in seconds for certain operations.
-t NUM
Set a timeout in tenths of seconds for block reception.
-T NUM
Set timeout in seconds for initial handshake.
-U
Do not unlink (remove) partially received files upon failure.
-v
Enable verbose output, showing transfer progress and details.
-V
Display version information and exit.
-w NUM
Wait for NUM seconds for the first character from the sender.
-X
Use Xmodem protocol instead of Zmodem.
-y
Clobber (overwrite) existing files without asking.
-Y
Clobber existing files without asking, similar to -y.
-Z
Use Zmodem protocol (this is the default).
DESCRIPTION
rz (receive Zmodem) is a command-line utility used for receiving files from a remote system over a serial connection or terminal emulator using the Zmodem file transfer protocol.
It is part of the lrzsz package, which provides implementations of the Zmodem, Ymodem, and Xmodem protocols for Linux/Unix-like systems. rz is particularly useful when transferring files over slow or unreliable links, or when interacting with embedded systems, modems, or old serial consoles, as Zmodem offers features like error checking, crash recovery, and efficient block transfers.
When rz is executed, it typically waits for a Zmodem sending program (like sz on the remote end) to initiate a transfer. Upon successful reception, the files are saved in the current working directory. The command supports various options to control behavior, such as overwriting existing files, preserving timestamps, verbose output, and more.
CAVEATS
rz requires a compatible Zmodem sender (like sz) on the remote end.
It primarily operates over serial connections or pseudo-terminals that correctly handle binary data and control characters. Modern environments often use SSH/SFTP for file transfers, making rz/sz less common for general-purpose use over IP networks, though still invaluable for serial console access.
Security considerations: Transferring files with rz typically does not involve encryption unless the underlying serial connection or terminal session is already encrypted (e.g., via SSH).
PROTOCOL DETAILS
rz defaults to the Zmodem protocol, which is generally preferred over Xmodem and Ymodem due to its better error detection, automatic recovery from dropped connections, and ability to transfer multiple files or directories in a single session. It can fallback or be forced to Xmodem using the -X option.
TYPICAL USAGE
A common scenario involves logging into a remote system via a serial console (e.g., /dev/ttyS0 or /dev/ttyUSB0) or an SSH session where direct scp or sftp might be unavailable or cumbersome.
The user would then run rz on the remote end, and sz <files> on their local machine, or vice versa, to initiate the transfer. Many terminal emulators have built-in Zmodem support that can automatically detect rz or sz prompts and handle the transfer seamlessly.
HISTORY
The rz/sz utilities are part of the lrzsz package, which implements the Zmodem, Ymodem, and Xmodem file transfer protocols. These protocols were widely used in the BBS (Bulletin Board System) era and over dial-up modems for reliable file transfers, especially Zmodem with its error recovery and batch capabilities.
The original rz and sz programs were developed by Chuck Forsberg. The lrzsz project is a free software port of these utilities to Linux and Unix-like systems, maintaining compatibility and adding enhancements.
Despite the rise of network-based file transfer protocols like SFTP and SCP, rz and sz remain crucial tools for interacting with serial consoles, embedded systems, or legacy hardware where a full network stack might not be available or practical. Their simplicity and robust error handling make them invaluable in such niche but important scenarios.