Linux系统中sz和rz命令详解(文件传输、上传、下载)
创始人
2025-01-17 06:08:17
0

rz和sz是Linux/Unix同Windows进行Zmodem文件传输的命令工具,都使用Zmodem文件传输协议。

  • rz: receive zmodem的缩写,运行该命令会弹出一个文件选择窗口,从本地选择文件上传到Linux服务器。
  • sz: send zmodem的缩写,将选定的文件发送(send)到本地服务器,即从Linux下载到Windows系统;

验证sz、rz软件包是否已经安装:

rpm -qa | grep lrzsz

yum install -y lrzsz

sz命令

        sz命令是利用ZModem协议来从Linux服务器传送文件到本地,一次可以传送一个或多个文件。

常用参数:

-a       :  以文本方式传输(ascii)。 -b       :  以二进制方式传输(binary)。 -e       :  对控制字符转义(escape),这可以保证文件传输正确。
[keepmoving@192 test]$ sz --help sz version 0.12.20 Usage: sz [options] file ...    or: sz [options] -{c|i} COMMAND Send file(s) with ZMODEM/YMODEM/XMODEM protocol     (X) = option applies to XMODEM only     (Y) = option applies to YMODEM only     (Z) = option applies to ZMODEM only   -+, --append                append to existing destination file (Z)   -2, --twostop               use 2 stop bits   -4, --try-4k                go up to 4K blocksize       --start-4k              start with 4K blocksize (doesn't try 8)   -8, --try-8k                go up to 8K blocksize       --start-8k              start with 8K blocksize   -a, --ascii                 ASCII transfer (change CR/LF to LF)   -b, --binary                binary transfer   -B, --bufsize N             buffer N bytes (N==auto: buffer whole file)   -c, --command COMMAND       execute remote command COMMAND (Z)   -C, --command-tries N       try N times to execute a command (Z)   -d, --dot-to-slash          change '.' to '/' in pathnames (Y/Z)       --delay-startup N       sleep N seconds before doing anything   -e, --escape                escape all control characters (Z)   -E, --rename                force receiver to rename files it already has   -f, --full-path             send full pathname (Y/Z)   -i, --immediate-command CMD send remote CMD, return immediately (Z)   -h, --help                  print this usage message   -k, --1k                    send 1024 byte packets (X)   -L, --packetlen N           limit subpacket length to N bytes (Z)   -l, --framelen N            limit frame length to N bytes (l>=L) (Z)   -m, --min-bps N             stop transmission if BPS below N   -M, --min-bps-time N          for at least N seconds (default: 120)   -n, --newer                 send file if source newer (Z)   -N, --newer-or-longer       send file if source newer or longer (Z)   -o, --16-bit-crc            use 16 bit CRC instead of 32 bit CRC (Z)   -O, --disable-timeouts      disable timeout code, wait forever   -p, --protect               protect existing destination file (Z)   -r, --resume                resume interrupted file transfer (Z)   -R, --restricted            restricted, more secure mode   -q, --quiet                 quiet (no progress reports)   -s, --stop-at {HH:MM|+N}    stop transmission at HH:MM or in N seconds       --tcp                   build a TCP connection to transmit files       --tcp-server            open socket, wait for connection   -u, --unlink                unlink file after transmission   -U, --unrestrict            turn off restricted mode (if allowed to)   -v, --verbose               be verbose, provide debugging information   -w, --windowsize N          Window is N bytes (Z)   -X, --xmodem                use XMODEM protocol   -y, --overwrite             overwrite existing files   -Y, --overwrite-or-skip     overwrite existing files, else skip       --ymodem                use YMODEM protocol   -Z, --zmodem                use ZMODEM protocol  short options use the same arguments as the long ones 

常用命令:

  • 如果能够确定所传输的文件是文本格式的,使用 sz -a files
  • 如果是二进制文件,使用 sz -be files

将123.xlsx文件下载到windows系统中(默认位置在桌面上): 

sz -y 123.xlsx 

sz -a 123.xlsx

rz命令

        rz:运行该命令会弹出一个文件选择窗口,从本地选择文件上传到Linux服务器。使用rz -y 命令时会弹出选择文件对话框

常用参数:

-b      :   以二进制方式,默认为文本方式。(Binary (tell it like it is) file transfer override.) -e      :   对所有控制字符转义。(Force sender to escape all control characters; normally XON, XOFF, DLE, CR-@-CR, and Ctrl-X are escaped.)
[keepmoving@192 test]$ rz --help rz version 0.12.20 Usage: rz [options] [filename.if.xmodem] Receive files with ZMODEM/YMODEM/XMODEM protocol     (X) = option applies to XMODEM only     (Y) = option applies to YMODEM only     (Z) = option applies to ZMODEM only   -+, --append                append to existing files   -a, --ascii                 ASCII transfer (change CR/LF to LF)   -b, --binary                binary transfer   -B, --bufsize N             buffer N bytes (N==auto: buffer whole file)   -c, --with-crc              Use 16 bit CRC (X)   -C, --allow-remote-commands allow execution of remote commands (Z)   -D, --null                  write all received data to /dev/null       --delay-startup N       sleep N seconds before doing anything   -e, --escape                Escape control characters (Z)   -E, --rename                rename any files already existing       --errors N              generate CRC error every N bytes (debugging)   -h, --help                  Help, print this usage message   -m, --min-bps N             stop transmission if BPS below N   -M, --min-bps-time N          for at least N seconds (default: 120)   -O, --disable-timeouts      disable timeout code, wait forever for data       --o-sync                open output file(s) in synchronous write mode   -p, --protect               protect existing files   -q, --quiet                 quiet, no progress reports   -r, --resume                try to resume interrupted file transfer (Z)   -R, --restricted            restricted, more secure mode   -s, --stop-at {HH:MM|+N}    stop transmission at HH:MM or in N seconds   -S, --timesync              request remote time (twice: set local time)       --syslog[=off]          turn syslog on or off, if possible   -t, --timeout N             set timeout to N tenths of a second   -u, --keep-uppercase        keep upper case filenames   -U, --unrestrict            disable restricted mode (if allowed to)   -v, --verbose               be verbose, provide debugging information   -w, --windowsize N          Window is N bytes (Z)   -X  --xmodem                use XMODEM protocol   -y, --overwrite             Yes, clobber existing file if any       --ymodem                use YMODEM protocol   -Z, --zmodem                use ZMODEM protocol  short options use the same arguments as the long ones 

上传文件到服务器:

rz -y 

相关内容

热门资讯

六分钟辅助“禅游指尖四川辅助”... 六分钟辅助“禅游指尖四川辅助”开挂(透视)辅助插件第三方教程-哔哩哔哩;无需打开直接搜索打开薇:13...
一分钟了解“蜀山四川小程序破解... 【亲,蜀山四川小程序破解版 这款游戏可以开挂的,确实是有挂的,很多玩家在这款蜀山四川小程序破解版中打...
教程辅助“wepoker可以免... 教程辅助“wepoker可以免费玩吗”开挂(透视)辅助插件-知乎;无需打开直接搜索薇:1367043...
九分钟辅助“wepoker有透... 九分钟辅助“wepoker有透视底牌吗”开挂(透视)辅助挂透明挂教程-知乎;无需打开直接搜索微信(1...
我来向大家传授“来物局怎么开挂... 来物局怎么开挂开挂教程视频分享装挂详细步骤在当今的网络游戏中,来物局怎么开挂作为一种经典的娱乐方式,...
教程辅助“腾威互娱 辅助工具”... 教程辅助“腾威互娱 辅助工具”开挂(透视)辅助工具-哔哩哔哩;无需打开直接搜索打开薇:1367043...
六分钟辅助“鸿狐辅助器”开挂(... 六分钟辅助“鸿狐辅助器”开挂(透视)辅助器技巧教程-知乎;打开点击测试直接进入微信(13670430...
一分钟揭秘“微信小程序辅助器免... 一分钟揭秘“微信小程序辅助器免费下载”附开挂工具辅助详细教程【无需打开直接搜索加薇136704302...
教程辅助“约战沙城挂机辅助”开... 教程辅助“约战沙城挂机辅助”开挂(透视)辅助器-哔哩哔哩 >>您好:软件加薇136704302信确实...
五分钟辅助“聚星ai辅助工具下... 五分钟辅助“聚星ai辅助工具下载”开挂(透视)辅助安装攻略教程-知乎聚星ai辅助工具下载ai黑科技系...