SZ(1)
Manual: SZ(1) β General Commands Manual β¨
πΈ NAME πΈ
Bestie, meet sx, sb, and sz β the XMODEM, YMODEM, ZMODEM file send girlies. π
β¨ SYNOPSIS β¨
sz [-+8abdefkLlNnopqTtuvyY] file ...
sb [-adfkqtuv] file ...
sx [-akqtuv] file
sz [-oqtv] -c COMMAND
sz [-oqtv] -i COMMAND
π DESCRIPTION π
Okay so sz uses the ZMODEM, YMODEM or XMODEM error correcting protocol to send one or more files over a dial-in serial port to a variety of programs running under multiple operating systems. Itβs giving cross-platform file-transfer main character energy. π¦
sz sends one or more files with ZMODEM protocol. Periodt.
ZMODEM greatly simplifies file transfers compared to XMODEM. In addition to a friendly user interface, ZMODEM gives Personal Computer and other users an efficient, accurate, and robust file transfer method. Lowkey iconic. π
ZMODEM provides complete END-TO-END data integrity between application programs. ZMODEMβs 32 bit CRC catches errors that sneak into even the most advanced networks. No cap, itβs that girl. π₯
Advanced file management features include AutoDownload (Automatic file Download initiated without user intervention), Display of individual and total file lengths and transmission time estimates, Crash Recovery, selective file transfers, and preservation of exact file date and length. Obsessed, honestly.
Output from another program may be piped to sz for transmission by denoting standard input with -:
ls -l | sz -
The program output is transmitted with the filename sPID.sz where PID is the process ID of the sz program. If the environment variable ONAME is set, that is used instead. In this case, the Unix command:
ls -l | ONAME=con sz -ay -
will send a βfileβ to the PC-DOS console display. The -y option instructs the receiver to open the file for writing unconditionally. The -a option causes the receiver to convert Unix newlines to PC-DOS carriage returns and linefeeds.
sb batch sends one or more files with YMODEM or ZMODEM protocol. The initial ZMODEM initialization is not sent. When requested by the receiver (!!!), sb supports YMODEM-g with "cbreak" tty mode, XON/XOFF flow control, and interrupt character set to CAN (^X). This increases throughput over error free channels (direct connection, X.PC, etc.) by not acknowledging each transmitted sector. β‘
The receiver included in this package does not request YMODEM-g. π
On Unix systems, additional information about the file is transmitted. If the receiving program uses this information, the transmitted file length controls the exact number of bytes written to the output dataset, and the modify time and file mode are set accordingly.
sx sends a single file with XMODEM or XMODEM-1k protocol (sometimes incorrectly called "ymodem"). The user must supply the file name to both sending and receiving programs.
If sz is invoked with $SHELL set and if that variable contains the string rsh , rbash or rksh (restricted shell), sz operates in restricted mode. Restricted mode restricts pathnames to the current directory and/or subdirectories thereof.
The fourth form sends a single COMMAND to a ZMODEM receiver for execution. sz exits with the COMMAND return value. If COMMAND includes spaces or characters special to the shell, it must be quoted.
The fifth form sends a single COMMAND to a ZMODEM receiver for execution. sz exits as soon as the receiver has correctly received the command, before it is executed. This form (and thus the -c/-i options) is deprecated and will be removed in a future release: it asks the receiving program to execute COMMAND, which only old ZMODEM implementations still do.
If sz is invoked with stdout and stderr to different datasets, Verbose is set to 2, causing frame by frame progress reports to stderr. This may be disabled with the q option.
π OPTIONS π
The meanings of the available options are, bestie:
-+,--appendβ Instruct the receiver to append transmitted data to an existing file (ZMODEM only).-2,--twostopβ Use two stop bits (if possible). Do not use this unless you know what you are doing. π-8,--try-8kβ Try to go up to 8KB blocksize. This is incompatible with standard zmodem, but a common extension in the bbs world. (ZMODEM only).-9β Short form of--start-8k.--start-8kβ Start with 8KB blocksize. Like--try-8k.-4,--try-4kβ Try to go up to 4KB blocksize. (ZMODEM only).-5β Short form of--start-4k.--start-4kβ Start with 4KB blocksize. Like--try-4k.-a,--asciiβ Convert NL characters in the transmitted file to CR/LF. This is done by the sender for XMODEM and YMODEM, by the receiver for ZMODEM. Deprecated: for ZMODEM this requests the historic ZCNL conversion, which current ZMODEM documentation marks as deprecated. It is kept for compatibility with old peers; new setups should use binary transfer.-b,--binaryβ (ZMODEM) Binary override: transfer file without any translation.-B NUMBER,--bufsize NUMBERβ Use a readbuffer ofNUMBERbytes. Default ist16384, which should be enough for most situations. If you have a slow machine or a bad disk interface or suffer from other hardware problems you might want to increase the buffersize.-1orautouse a buffer large enough to buffer the whole file. Be careful with this option β things normally get worse, not better, if the machine starts to swap. π-c COMMAND,--command COMMANDβ sendsCOMMANDover to the receiver so it runs it, and then you return withCOMMAND's exit status. Deprecated alert π© β this literally asks the receiving program to executeCOMMAND. It's hanging around for compatibility with ancient ZMODEM implementations (OMEN zmodem and older lrz) that still execute received commands, and bestie, it will be removed in a future release. New setups should not use it. Modern receivers (including lrz) never execute commands and just answer with a failure status. π-C N,--command-tries Nβ retry sending the commandNtimes (default:11). Only meaningful together with-c/-i, which are, as established, deprecated. π--delay-startup Nβ waitNseconds before doing literally anything. Caffeine break. β--no-unixmodeβ sends a mode field of0in the ZMODEM file header instead of the file's Unix permission bits. By default, lsz transmits the fullst_modeas returned byfstat(2), including permission bits (rwx) and setuid, setgid, and sticky bits. The recipient may β and honestly likely will β modify the mode before applying it. For example, lrz masks the received mode with0777in normal operation (stripping setuid, setgid, and sticky) and with0666under restricted shell (also stripping execute bits). Use--no-unixmodeto leave permission selection entirely to the receiver's defaults (or to keep that information for yourself). π-e,--escapeβ escape all control characters; normally XON, XOFF, DLE, CR-@-CR, and Ctrl-X are escaped. π¦-E,--renameβ forces the sender to rename the new file if a file with the same name already exists. No overwriting drama, periodt. β¨-f,--full-pathβ send the full pathname. Normally directory prefixes are stripped from the transmitted filename. Deprecated π©: current ZMODEM documentation states that a sender MUST NOT transmit absolute pathnames or..components. This option is kept for compatibility with the historical behavior (OMEN sz and derivatives, and for mirroring directory trees with relative paths); a future release will continue to allow relative paths but will reject absolute paths and..components with a fatal error. New setups should use plain relative filenames. π-h,--helpβ give help. Iconic.-H,--crc-checkβ (ZMODEM) accept and transfer files if the file lengths and/or the CRCs differ. Yolo checksum vibes.-i COMMAND,--immediate-command COMMANDβ sendsCOMMANDto the receiver for execution and returns immediately upon the receiving program's successful reception of the command. Deprecated π© for the same reasons as-c; kept for compatibility with old ZMODEM implementations that still execute received commands, and it will be removed in a future release.-J FILE,--journal FILEβ appends a transfer-statistics line toFILEfor each file sent. The line is made ofkey=valuepairs including timestamp, direction (dir=tx), filename, status, byte counts, duration, and throughput. The file is created if it doesn't exist and appended to on each invocation. Receipts! π§Ύβ¨-k,--1kβ (XMODEM/YMODEM) send files using1024byte blocks rather than the default128byte blocks.1024byte packets speed file transfers at high bit rates. (ZMODEM streams the data for the best possible throughput.) π₯-L N,--packetlen Nβ use ZMODEM sub-packets of lengthN. A largerN(32 <= N <= 1024) gives slightly higher throughput; a smallerNspeeds error recovery. The default is128below 300 baud,256above 300 baud, or1024above 2400 baud. ποΈ-m N,--min-bps Nβ stop transmission if the BPS-Rate (Bytes Per Second) falls belowNfor a certain time (see the--min-bps-timeoption). The check is per file: the timer resets at the start of each file. πβ‘οΈπ-M N,--min-bps-timeβ used together with--min-bps. Default is120(seconds). The timeout is per file: a slow transfer of one file does not count toward the next file's timeout. β±οΈ-l N,--framelen Nβ wait for the receiver to acknowledge correct data everyN(32 <= N <= 1024) characters. This may be used to avoid network overrun when XOFF flow control is lacking. π«Ά--sync-transferβ (ZMODEM) integrity mode: wait for the receiver's acknowledgement after every data sub-packet (a ZCRCW round trip) instead of streaming. On a packetized transport an entire sub-packet together with its terminator and CRC can be silently swallowed, which plain streaming cannot detect (the CRC is position independent and the frame position is only checked at the start of a ZDATA frame). The cost is one round trip per sub-packet, causing a substantial throughput loss on slow or high-latency lines. This option is only needed on transports that can silently drop a contiguous chunk of the byte stream β for example a packet radio or other datagram link that loses packets without retransmitting them, or a line that overruns its buffer when flow control fails. It is pointless on transports that hide packet loss by retransmitting internally, so that no loss reaches the byte stream (TCP, ISDN, X.25), and wasteful on transports that only corrupt individual characters (noisy modem or serial lines): there the CRC catches the damage and the normal resync heals it, streaming is safe and faster. π‘οΈ-n,--newerβ (ZMODEM) send each file if the destination file does not exist. Overwrite the destination file if the source file is newer than the destination file. ποΈ-N,--newer-or-longerβ (ZMODEM) send each file if the destination file does not exist. Overwrite the destination file if the source file is newer or longer than the destination file. π-o,--16-bit-crcβ (ZMODEM) disable automatic selection of 32 bit CRC.-O,--disable-timeoutsβ disables read timeout handling. This makes lsz hang if the other side doesn't send anything, but increases performance (not much) and decreases system load (reduces number of system calls by about50percent).
Use this option with care. π Seriously.
-p,--protectβ (ZMODEM) protect existing destination files by skipping the transfer if the destination file exists. π-q,--quietβ quiet suppresses verbosity. Shhh. π€«-R,--restrictedβ restricted mode: restricts pathnames to the current directory and/or subdirectories thereof. See SECURITY. π-r,--resumeβ (ZMODEM) resume an interrupted file transfer. If the source file is longer than the destination file, the transfer commences at the offset in the source file that equals the length of the destination file. Pick up where you left off, bestie. β―οΈ-s HH:MM,--stop-at HH:MMβ stop transmission atHHhours,MMminutes. Another variant, using+Ninstead ofHH:MM, stops transmission inNseconds. The deadline is tracked with a one-second granularity because of the way the check is implemented (theNargument is parsed before any data flows and compared against integer seconds afterwards); the transfer stops during the second after the deadline is reached, so a transfer stops within aboutN+1toN+2seconds. β°--syslog[=off]β turn syslogging on or off. Syslog is on by default. π-t TIM,--timeout TIMβ change timeout toTIMtenths of seconds.-T,--turboβ do not escape certain characters (^P,^P|0x80, telenet escape sequence[CR + @]). This improves performance by about1percent and shouldn't hurt in the normal case (but be careful β^Pmight be useful if connected through a terminal server). ποΈπ¨-u,--unlinkβ unlink the file after successful transmission. Gone, reduced to atoms. ποΈ-U,--unrestrictβ removed. See SECURITY.-w N,--windowsize Nβ limit the transmit window size toNbytes (ZMODEM). πͺ-v,--verboseβ verbose output to stderr. With onev, a summary (file names, transfer result, error events) is printed. With twovs, progress reports are also shown. Morevs are accepted but have no effect. Since version0.13detailed protocol debugging is available with--debuginstead. π£οΈ--debug=MODULESβ enable debug output for the comma separated list ofMODULESon stderr. Known modules:"protocol"(ZMODEM frame state machine),"readline"(line reader: select/read calls, timeouts, hex dump),"transfer"(file transfer state machine),"windowhandling"(adaptive block length and window logic, ZMODEM only),"tty"(terminal mode changes). The special name"all"enables all. π-X,--xmodemβ use XMODEM protocol.-y,--overwriteβ instruct a ZMODEM receiving program to overwrite any existing file with the same name. π₯-Y,--overwrite-or-skipβ instruct a ZMODEM receiving program to overwrite any existing file with the same name, and to skip any source files that do have a file with the same pathname on the destination system. The duality of girl. π-g,--ymodemβ use ZMODEM protocol.-Z,--zmodemβ use ZMODEM protocol.
π SECURITY π
Restricted mode restricts pathnames to the current directory and/or subdirectories thereof: absolute pathnames and references to a parent directory are not sent, and lsz refuses to send remote commands (the -c/-i options). π«
Restricted mode is entered if the R option is given, or if lsz detects that it runs under a restricted shell, or if the environment variable ZMODEM_RESTRICTED is set. Restricted mode cannot be turned off; the U option has been removed (see HISTORICAL NOTES). No take-backs, no escape hatch. π
πΏ ENVIRONMENT πΏ
ZNULLSβ may be used to specify the number of nulls to send before a ZDATA frame. This is a 1980s modem workaround and of questionable benefit today. It is kept for compatibility. π΅π»SHELLβ lsz recognizes a restricted shell if this variable includesrshorrksh. πZMODEM_RESTRICTEDβ lsz enters restricted mode if the variable is set. π§
β¨ EXAMPLES β¨
π¦ ZMODEM File Transfer π¦
% sz -a *.c
Okay so this one command sends, like, every .c file in the current directory, and the -a is doing the conversion thing β it converts to whatever end-of-line conventions the receiving environment wants. Slay. β¨
% sz -Yan *.c *.h
This one's pickier, and honestly she's iconic for it: it sends only the .c and .h files that exist on both systems, and that are newer on the sending system than the matching version on the receiving system. Plus it converts Unix to DOS text format if needed. Selective queen behavior π
πΈ XMODEM File Transfer πΈ
% sx -a foo.c
ESC
rx foo.c
These three commands (yes, that middle line is literally ESC β it's part of the sequence, don't skip it π) move a single file from the local machine to the remote one, while sz translates Unix newlines to DOS CR/LF.
Bestie, warning: this combo is much slower and far less reliable than ZMODEM. Like, XMODEM is giving vintage typewriter energy. Use it if you must, but know what you're signing up for. π
π ERROR MESSAGES π
If you ever see "Caught signal 99" β yeah, that means the program was not properly compiled. For the details, go look at "bibi(99)" in rbsb.c. Iykyk. π«Ά
π SEE ALSO π
lrzZMODEM.DOCYMODEM.DOC
Also: the compile time options required for the various operating systems are described in the source file. Go read the source, bestie, it's good for you π
π BUGS π
Prepare yourself, this list is a journey π’
- On at least one BSD system,
szwould hang or exit when it got within a few kilobytes of the end of file. Using the-w 8192flag fixed the problem. The real cause is unknown β maybe a bug in the kernel TTY output routines. Spooky. π» - Programs that don't properly implement the specified file transfer protocol may cause
szto "hang" the port for a minute or two. Not her fault, she's doing her best. π€ - Many programs claiming to support YMODEM only support XMODEM with 1k blocks, and they often don't get that quite right. Fake fans, honestly. π
- XMODEM transfers add up to 127 garbage bytes per file. XMODEM-1k and YMODEM-1k transfers use 128 byte blocks to avoid that extra padding. Little byte crumbs everywhere, no thank you. π
- YMODEM programs use the file length transmitted at the beginning of the transfer to prune the file to the correct length β this may cause problems with source files that grow during the course of the transfer. This problem does not pertain to ZMODEM transfers, which preserve the exact file length unconditionally. ZMODEM stays winning π
- Most ZMODEM options are merely passed to the receiving program; some do not implement all these options. So like, she forwards the message, but the other side might leave it on read. π
- Circular buffering and a ZMODEM sliding window should be used when input is from pipes instead of acknowledging frames each 1024 bytes. And if no files can be opened,
szsends a ZMODEM command to echo a suitable complaint β perhaps it should check for the presence of at least one accessible file before getting hot and bothered. Valid critique tbh π₯
π©Ή WORKAROUNDS π©Ή
A few high speed modems have (had?) a firmware bug that drops characters when the direction of high speed transmission is reversed. The environment variable ZNULLS may be used to specify the number of nulls to send before a ZDATA frame. Values of 101 for a 4.77 MHz PC and 124 for an AT were typical. Vintage tech, vintage fixes π°οΈ
β οΈ CAVEATS β οΈ
Okay this is the important part, so like, pay attention bestie π«Ά
The ZMODEM protocol uses 32-bit fields for file positions, imposing a hard limit of 4 GiB on transfer size.
Furthermore, many ZMODEM implementations derived from the original Omen Technology codebase (including crzsz, rzsz, lrzszolderthanversion0.13, and other 1990s variants) β and also at least some independent implementation β use signed long internally, which on 32-bit platforms limits correct operation to files below 2 GiB.
lsz itself handles positions up to 4 GiB correctly, but interoperability with older or 32-bit receivers may fail for files larger than 2 GiB.
lsz prints a warning when sending files larger than 2 GiB; use -q to suppress it.
fr fr, if you're yeeting multi-gigabyte files through ancient ZMODEM code, that's your villain origin story π
π¦ HISTORICAL NOTES π¦
Grab a snack, we're doing lore π
When a receiver ends the session with a ZABORT frame (or ZFERR, which the ZMODEM documentation defines as equivalent), lsz replies with the ZFIN sequence the documentation requires and then ends the session cleanly. Older lsz versions, as well as OMEN-derived senders, answered with the cancel sequence instead.
The outcome β transfer aborted, exit status 0x80 β is the same, so this only matters to peers that inspect the reply. So like, same ending, different goodbye text. β¨
π Gone but not forgotten (rip to these) π
The following options and features have been removed and are no longer functional. Using the options prints an error message and exits.
-S,--timesyncβ Time synchronization. Removed because no other still-available implementation supported it, and setting the local time would have required root privileges.-U,--unrestrictβ Turned off restricted mode (impossible under a restricted shell). Removed because security-relevant options cannot be turned off: whoever can pass-Ucan equally well drop it from the command line, so the option provided no protection β only a trap. See SECURITY.PUBDIRβ ThePUBDIRenvironment variable and the associated public directory feature (restricting file transfers toPUBDIR, usually/var/spool/uucppublic) have been removed.-d,--dot-to-slashβ Converted dots to slashes in pathnames and truncated filenames to 8.3 format for MS-DOS / CP-M compatibility. Removed because these systems are obsolete. Use-f/--full-pathto send full pathnames.
πΈ and that's the whole page, bestie πΈ
This one's from lrzsz-0.12b, dated 2.6.1996 β yes, she's vintage, she's been through things, and she's still serving. Go transfer some files responsibly. You got this ππ
π¦ where this page comes from
- arch rolling: lrzsz 0.13.1-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms