SZ(1)
๐ฆ sz(1) โ General Commands Manual, group-chat edition ๐ฆ
๐ธ NAME ๐ธ
sz, sb, sx โ XMODEM, YMODEM, ZMODEM file send. Thatโs the whole vibe, bestie: three little senders doing file-send things with those protocols. ๐
โจ SYNOPSIS โจ
Okay so the forms are literally these, character for character โ no cap:
sz [-+8abdefkLlNnopqTtuvyY] file ...
sb [-adfkqtuv] file ...
sx [-akqtuv] file
sz [-oqtv] -c COMMAND
sz [-oqtv] -i COMMAND
sz -TT
๐ DESCRIPTION ๐
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 PC-DOS, CP/M, Unix, VMS, and other operating systems. Itโs giving โserial port main character energy,โ honestly. ๐ซถ
While rz is smart enough to be called from cu(1), very few versions of cu(1) are smart enough to allow sz to work properly. Unix flavors of Professional-YAM are available for such dial-out application. Iconic, but also lowkey a little tragic. ๐ญ
sz sends one or more files with ZMODEM protocol.
ZMODEM greatly simplifies file transfers compared to XMODEM. In addition to a friendly user interface, ZMODEM provides Personal Computer and other users an efficient, accurate, and robust file transfer method. Slay. โจ
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. The way it checks everything? Obsessed. ๐
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. Thatโs a whole feature set, periodt. ๐
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. Cute little newline glow-up. ๐
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). YMODEM-g (Professional-YAM g option) increases throughput over error free channels (direct connection, X.PC, etc.) by not acknowledging each transmitted sector. Itโs giving โskip the small talk, just send.โ ๐
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. Exact file date and length preservation? We love to see it. ๐ฆ
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. One file, both sides gotta know the name โ no cap. ๐
If sz is invoked with $SHELL set and iff 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 PUBDIR (usually /usr/spool/uucppublic) and/or subdirectories thereof. Safety rails, bestie. ๐ก๏ธ
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. Quote it, fr fr. ๐
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. Receipt first, execution later โ iykyk. โจ
The sixth form (sz -TT) attempts to output all 256 code combinations to the terminal. If you are having difficulty sending files, this command lets you see which character codes are being eaten by the operating system. Literally a vibe check for your character codes. ๐
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. Frame-by-frame updates? Highkey extra, but useful. ๐ซถ
The meanings of the available options are:
โจ OPTIONS โจ
-+,--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).--start-8kโ Start with 8KB blocksize. Like--try-8k.-a,--asciiโ ConvertNLcharacters in the transmitted file toCR/LF. This is done by the sender for XMODEM and YMODEM, by the receiver for ZMODEM.-b,--binaryโ (ZMODEM) Binary override: transfer file without any translation.-B NUMBER,--bufsize NUMBERโ Use a readbuffer ofNUMBERbytes. Default is16384, 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.
Using this option turns off memory mapping of the input file. This increases memory and cpu usage.
-c COMMAND,--command COMMANDโ SendCOMMANDto the receiver for execution, return withCOMMANDโs exit status.-C N,--command-tries Nโ Retry to send commandNtimes (default:11).-d,--dot-to-slashโ Change all instances of"."to"/"in the transmitted pathname. Thus,C.omenB0000(which is unacceptable to MSDOS or CP/M) is transmitted asC/omenB0000. If the resultant filename has more than8characters in the stem, a"."is inserted to allow a total of eleven.
This option enables the --full-path option.
--delay-startup Nโ WaitNseconds before doing anything.-e,--escapeโ Escape all control characters; normallyXON,XOFF,DLE,CR-@-CR, andCtrl-Xare escaped.- the original drops this line here with no flag attached, so Iโm not inventing one, bestie โ Force the sender to rename the new file if a file with the same name already exists.
-f,--full-pathโ Send Full pathname. Normally directory prefixes are stripped from the transmitted filename.
This is also turned on with the --dot-to-slash option.
-h,--helpโ Give help.-i COMMAND,--immediate-command COMMANDโ SendCOMMANDto the receiver for execution, return immediately upon the receiving programโs successful reception of the command.-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 is128below300baud,256above300baud, or1024above2400baud.-m N,--min-bps Nโ Stop transmission if BPS-Rate (Bytes Per Second) falls belowNfor a certain time (see--min-bps-timeoption).-M N,--min-bps-timeโ Used together with--min-bps. Default is120(seconds).-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.-n,--newerโ (ZMODEM) Send each file if destination file does not exist. Overwrite destination file if source file is newer than the destination file.-N,--newer-or-longerโ (ZMODEM) Send each file if destination file does not exist. Overwrite destination file if 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โ Disable read timeout handling. This makeslszhang 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. ๐
-p,--protectโ (ZMODEM) Protect existing destination files by skipping transfer if the destination file exists.-q,--quietโ Quiet suppresses verbosity.-R,--restrictedโ Restricted mode: restricts pathnames to the current directory andPUBDIR(usually/usr/spool/uucppublic) and/or subdirectories thereof.-r,--resumeโ (ZMODEM) Resume 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.-s HH:MM,--stop-at HH:MMโ Stop transmission atHHhours,MMminutes. Another variant, using+Ninstead ofHH:MM, stops transmission inNseconds.-S,--timesyncโ Enable timesync protocol support. Seetimesync.docfor further information.
This option is incompatible with standard zmodem. Use it with care. ๐ธ
--syslog[=off]โ Turn syslogging on or off. The default is set at configure time. This option is ignored if no syslog support is compiled in.-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).--tcpโ Try to initiate a TCP/IP connection.lszwill ask the receiving zmodem to open a TCP/IP connection. All handshaking (which address / port to use) will be done by the zmodem programs.
You will normally not want to use this option as lrzsz is the only zmodem which understands what to do (private extension). You might want to use this option if the two programs are connected (stdin/out) over a slow or bad (not 8bit clean) network connection.
Use of this option imposes a security risk, somebody else could connect to the port in between. See SECURITY for details. ๐จ
--tcp-client ADDRESS:PORTโ Act as a tcp/ip client: Connect to the given port.
See --tcp-server for more information.
--tcp-serverโ Act as a server: Open a socket, print out what to do, wait for connection. ๐ซถ
Okay so, quick vibe check on this one: you will normally not want to use this option, because lrzsz is literally the only zmodem that understands what to do with it (it's a private extension, iykyk). You might want it if you're stuck having to use zmodem โ for whatever reason, not my business ๐ซถ โ and you cannot use the --tcp option of lsz, maybe because your telnet doesn't allow spawning a local program with stdin/stdout connected to the remote side.
If you do go for it, you have to start lsz with the --tcp-client ADDRESS:PORT option. lrz will print the address and port on startup. โจ
โ ๏ธ Using this option imposes a security risk, bestie โ somebody else could connect to the port in between. See SECURITY for the details. ๐
-uโ Unlink the file after a successful transmission. Bye file, you ate. ๐-U,--unrestrictโ Turn off restricted mode. Heads up: this is not possible if you're running under a restricted shell. ๐ซ-w N,--windowsize Nโ Limit the transmit window size toNbytes (ZMODEM). Tiny window, cozy vibes. ๐ช-v,--verboseโ Verbose output to stderr. Morev's = more output, it's giving main character energy that never stops talking. ๐ฃ๏ธ-X,--xmodemโ use XMODEM protocol.-y,--overwriteโ Instruct a ZMODEM receiving program to overwrite any existing file with the same name. No mercy, no duplicates. ๐-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. Overwrite or ghost, pick one. โจ--ymodemโ use ZMODEM protocol. (Yes, that is literally what the page says. I'm not messing with you ๐)-Z,--zmodemโ use ZMODEM protocol. Periodt. ๐
๐ก๏ธ SECURITY
Restricted mode restricts pathnames to the current directory and PUBDIR (usually /var/spool/uucppublic) and/or subdirectories thereof, and it disables remote command execution. Basically it keeps everything inside the velvet rope. ๐
You enter restricted mode if:
- the
Roption is given, or lszdetects that it runs under a restricted shell, or- the environment variable
ZMODEM_RESTRICTEDis found.
Restricted mode can be turned off with the U option โ unless you're running under a restricted shell, in which case, nope, the door stays locked. ๐
๐จ Real talk: use of the--tcp-clientor--tcp-serveroptions imposes a security risk, as somebody else could connect to the port before you do it, and grab your data. If there's strong demand for a more secure mode, the author might introduce some sort of password challenge. Until then... be careful out there. ๐
๐ฑ ENVIRONMENT
ZNULLSโ may be used to specify the number of nulls to send before aZDATAframe.SHELLโlszrecognizes a restricted shell if this variable includesrshorrksh.ZMODEM_RESTRICTEDโlrzenters restricted mode if the variable is set.TMPDIRโ if this environment variable is set, its content is used as the directory to place in the answer file to a timesync request.TMPโ used instead ofTMPDIRifTMPDIRis not set. If neitherTMPDIRnorTMPis set,/tmpwill be used. ๐ธ
๐ EXAMPLES
ZMODEM File Transfer (Unix to DSZ/ZCOMM/Professional-YAM)
% sz -a *.c
This single command transfers all .c files in the current Unix directory with conversion (-a) to end of line conventions appropriate to the receiving environment. With ZMODEM AutoDownload enabled, Professional-YAM and ZCOMM will automatically receive the files after performing a security check. Slay. ๐ฅ
% sz -Yan *.c *.h
Send only the .c and .h files that exist on both systems, and are newer on the sending system than the corresponding version on the receiving system, converting Unix to DOS text format.
$ sz -\Yan file1.c file2.c file3.c foo.h baz.h ยฎ(for VMS)
ZMODEM Command Download (Unix to Professional-YAM)
cpszall:all
sz -c "c:;cd /yam/dist"
sz -ya $(YD)/*.me
sz -yqb y*.exe
sz -c "cd /yam"
sz -i "!insms"
This Makefile fragment uses sz to issue commands to Professional-YAM to change the current disk and directory. Next, sz transfers the .me files from the $YD directory, commanding the receiver to overwrite the old files and to convert from Unix end of line conventions to PC-DOS conventions. The third line transfers some .exe files. The fourth and fifth lines command Pro-YAM to change directory and execute a PC-DOS batch file insms. Since the batch file takes considerable time, the -i form is used to allow sz to exit immediately. Efficient queen behavior. ๐
XMODEM File Transfer (Unix to Crosstalk)
% sx -a foo.c
ESC
rx foo.c
The above three commands transfer a single file from Unix to a PC and Crosstalk with sz translating Unix newlines to DOS CR/LF. Ngl though โ this combination is much slower and far less reliable than ZMODEM. ๐ญ
๐ ERROR MESSAGES
"Caught signal 99" indicates the program was not properly compiled โ refer to "bibi(99)" in rbsb.c for details. Not a vibe, but okay. ๐
๐ SEE ALSO
rz(omen), ZMODEM.DOC, YMODEM.DOC, Professional-YAM, crc(omen), sq(omen), todos(omen), tocpm(omen), tomac(omen), yam(omen)
Compile time options required for various operating systems are described in the source file. Go read the source, bestie, it's iconic. ๐
๐ฅ๏ธ VMS VERSION
The VMS version does not support wild cards. Because of VMS DCL, upper case option letters must be represented by \ preceding the letter. ๐
The current VMS version does not support XMODEM, XMODEM-1k, or YMODEM.
โ ๏ธ VMS C Standard I/O and RMS may interact to modify the file contents. That's the whole warning, no further explanation, and honestly? Same.
๐ FILES
- 32 bit CRC code courtesy Gary S. Brown. ๐ซถ
sz.c,crctab.c,rbsb.c,zm.c,zmodem.hโ Unix source filessz.c,crctab.c,vrzsz.c,zm.c,zmodem.h,vmodem.h,vvmodem.cโ VMS source files/tmp/szlogstores debugging output (sz -vv) (szlogon VMS).
๐งช TESTING FEATURE
The command sz -T file exercises the Attn sequence error recovery by commanding errors with unterminated packets. The receiving program should complain five times about binary data packets being too long. Each time sz is interrupted, it should send a ZDATA header followed by another defective packet. If the receiver does not detect five long data packets, the Attn sequence is not interrupting the sender, and the Myattn string in sz.c must be modified. ๐ง
After 5 packets, sz stops the "transfer" and prints the total number of characters "sent" (Tcount). The difference between Tcount and 5120 represents the number of characters stored in various buffers when the Attn sequence is generated. Numbers queen. โจ
๐ญ BUGS
- Calling
szfrom most versions ofcu(1)doesn't work, becausecu's receive process fightsszfor characters from the modem. Messy. ๐ - 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 8192"flag fixed the problem. The real cause is unknown โ perhaps a bug in the kernel TTY output routines. Spooky. ๐ป - Programs that do not properly implement the specified file transfer protocol may cause
szto "hang" the port for a minute or two. This problem is corrected by using ZCOMM, Pro-YAM, or another program with a correct implementation of the specified protocol. ๐ - Many programs claiming to support YMODEM only support XMODEM with 1k blocks, and they often don't get that quite right. Not them lying on main. ๐
- XMODEM transfers add up to 127 garbage bytes per file. XMODEM-1k and YMODEM-1k transfers use 128 byte blocks to avoid extra padding.
- 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.
- Circular buffering and a ZMODEM sliding window should be used when input is from pipes instead of acknowledging frames each 1024 bytes. 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. The test mode leaves a zero length file on the receiving system. ๐ฌ - A few high speed modems have a firmware bug that drops characters when the direction of high speed transmission is reversed. The environment variable
ZNULLSmay be used to specify the number of nulls to send before aZDATAframe. Values of101for a 4.77 mHz PC and124for an AT are typical. ๐
And that's the whole page, bestie!! This one's from lrzsz-0.12b, dated 2.6.1996 โ a vintage icon, honestly, and it still serves. Take care of your ports, don't fight your modem, and remember: overwrite responsibly. ๐โจ๐
๐ฆ where this page comes from
- opensuse-leap 16.0: rzsz 0.12.21~rc-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: rzsz 0.12.21~rc-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: rzsz 0.12.21~rc-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: rzsz 0.12.21~rc-160000.2.2 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms