linux rz upload sz download command details

  • 2020-10-31 22:05:39
  • OfStack

rz, sz is the command line tool for Linux/Unix to transfer ZModem files with Windows.

Use premise:

First, your Linux side (CentOS, Ubuntu) needs to install the rz/sz command, which is the lszrz package.

Second, the windows side needs the telnet/ssh client that supports ZModem (Xshell, SecureCRT supported, it seems that putty does not), and SecureCRT can log in to the Unix/Linux host with SecureCRT (telnet or ssh are ok).

Run the command rz to receive the file, and xshell will pop up the file selection dialog. After selecting the file, close the dialog and the file will be uploaded to the current directory in linux. If you want to upload a file, just click on the file and drag it into ES37en-ES38en 1

Running the sz file command means sending a file to windows (the directory you saved is configurable) is much more convenient than the ftp command, and the server no longer has to open FTP

Install lrzsz on Linux

The SSH client software alone does not support the above file transfer protocols (ASCII,Xmodem, Ymodem,Zmodem). We also need to install corresponding software on our Linux server to support these file transfer protocols. On Linux, lrzsz does this, and lrzsz is a tool that supports the Zmodem transport protocol. We send/receive files via sz/rz. If the package lrzsz is not installed in our system, an error will be reported and the installation can be resolved.


[root@localhost ~]# rz
-bash: rz: command not found
## For CentOS/RHEL
[root@localhost ~]# yum -y install lrzsz
 
## For Ubuntu
# sudo apt-get install lrzsz

Understand the memory

Among them, I used the following methods (often confused) to understand and remember sz and rz:

s in sz means send (send) and tells the client that I (the server) want to send the file send to cilent, which is equivalent to the client is downloading.

r in rz means received (to receive) and tells the client that I (the server) want to receive the file received by cilent, which is equivalent to the client uploading.

Use the sample

rz upload command. If a file already exists, the upload will not be performed by default. -ES93en overwrite is required


[root@szxjdw01-a-pro-14 ~]# cd /data/backup/war/
[root@szxjdw01-a-pro-14 war]# ll
total 308888
-rw-r--r-- 1 root root 79681963 Aug 4 14:59 test.tar.gz
[root@test war]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring jdwin-ucenter-rpc-service-assembly.tar.gz...
jdwin-ucenter-rpc-service-assembly.tar.gz was skipped
 
[root@test war]# rz -y
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring jdwin-ucenter-rpc-service-assembly.tar.gz...
 100%  77814 KB   855 KB/sec  00:01:31    0 Errors 
 
[root@test war]# ll
total 308888
-rw-r--r-- 1 root root 79681952 Aug 4 15:53 test.tar.gz

disadvantages

Using lszrz is convenient, but with one drawback: you can't transfer files larger than 4G.
So what do you do? You can use Filezilla, SecureFX and other FTP tools instead.


Related articles: