Introduction
Introduction to RZ and SZ commands
rz, sz are command-line tools for transferring ZModem files between Linux/Unix and Windows.
The Zmodem protocol is an error checking protocol for modem. Using the Zmodem protocol, data blocks of 512 bytes can be sent on the modem. If an error occurs in a data block, the receiving end will send a "NEC" response, so the data block will be retransmitted. It is an enhanced form of the Xmodem file transfer protocol, which not only can transfer larger data, but also has a lower error rate. Contains a feature called checkpoint restart that, if the communication link is interrupted in the middle of a data transfer, resumes the transfer from the point of interruption rather than from the beginning.
To install the rz and sz commands on Linux, the lrzsz package needs to be installed first. It can be installed with the following command:
-
For Ubuntu and Debian:
sudo apt-get update sudo apt-get install lrzsz
-
For CentOS and Fedora:
sudo yum install -y lrzsz
Once installed, you can use the rz and sz commands for file transfers.
Instructions
SZ command
Send the selected files to the local machine. sz
The command is to use the ZModem protocol to transfer files from the Linux server to the local, one or more files can be transferred at a time. Correspondingly, to upload files from the local to the Linux server, you can use rz
the command.
-
Common parameters:
-a
: Transfer as text (ascii).-b
: Transmit in binary mode (binary).-e
: Escape control characters (escape), which can ensure correct file transfer. -
If you can be sure that the transferred file is in text format, use:
sz -a files
-
For binary files, use:
sz -be files
RZ command
Running this command will pop up a file selection window, select a file locally and upload it to the Linux server
Common parameters:
-b
: In binary mode, the default is text mode. (Binary (tell it like it is) file transfer override.)-e
: Escapes all control characters.- If you want to ensure that the content of the uploaded file is consistent with the original file after being saved on the server side, it is best to set these two flags at the same time, as shown below:
rz -be
When this command is executed, a file selection dialog box will pop up. After selecting the file to be uploaded, click OK to start the uploading process. The upload speed depends on the network conditions at the time.
If "0 error" is displayed after execution, the file upload is successful, and other displays indicate that there is a problem with the file upload.
Introduction to Mobaxterm
- Enter the path to the directory where you want to transfer the files in the Remote Path box.
- Click the Upload button and wait for the file transfer to complete.
Transfer files from remote server to local
- Start Mobaxterm and connect to the remote server.
- Select the "SFTP" tab in the left panel of Mobaxterm.
- In the SFTP Session window, select the Remote Files tab and browse for the file to transfer.
- Enter the path to the directory where you want to transfer the file in the Local Path box.
- Click the "Download" button and wait for the file transfer to complete.
- In the SFTP Session window, select the Local Files tab and browse for the file to transfer.
- Select the "SFTP" tab in the left panel of Mobaxterm.
- Start Mobaxterm and connect to the remote server.
Transfer files from local to remote server
Mobaxterm is a terminal and file transfer software that supports Windows and Linux. File transfer with Mobaxterm is very easy.
Change to SCP transfer when SFTP is not available
When your server does not support SFTP, you can change the session to use SCP to transfer data.
-
Right click on your session → select
Edit session
-
Select
AdvancedSSHsettings
tab→SSH browser type and select SCP.
When encountering the status of card master SFTP transmission card master being 0%, you can adjust this option to try to solve the problem.
Mobaxterm uses the RZ/SZ command
Mobaxterm does not support the rz and sz commands in the default downloaded version. will throw an error rz ▒z waiting to receive.**B0100000023be50
(sz also).
In order to make Mobaxterm support Zmodem protocol, Mobaxterm adopts plug-in implementation.
-
Now you can go to the official website to download the CygUtils.plugin and lrzsz plugins.
-
Put the downloaded plug-in in the installation directory of Mobaxterm.
-
At this time, we can right-click again to see the option to upload and download.
Summarize
This article introduces the rz and sz commands for file transfer between Linux/Unix and Windows, and the method of using Mobaxterm for file transfer. Also, how to use rz, sz commands in Mobaxterm and how to change session from SFTP to SCP transfer.