Detailed examples of the use of rz commands under Linux

  
                

Linux rz command and sz command can be used for file transfer, and rz command is mainly used for file upload. The following will give you a detailed introduction to the usage of rz command under Linux through several examples. Let's learn it together. .

rz command can bulk upload, of course, you can upload a single file. The protocol used is the old ZMODEM protocol, although the protocol is old, but does not affect the ease of use. In general, we need to upload files to the Linux system, either use ftp (and have to set up the ftp server), or use sftp, upload a file to knock a lot of commands. The rz command introduced here only needs to simply hit the rz -be command on the command line. Under SecureCRT, the file selection box will pop up to let you select the files to be uploaded, and you can select multiple; however, if it is With putty, there is nothing you can do.

The following simply describes the ZModem protocol, starting with the XMODEM protocol (XMODEM Protocol). The XMODEM protocol is an asynchronous file transport protocol widely used in personal computer communications using dial-up modems. This protocol transmits data in blocks of 128 bytes, and each block uses a checksum procedure for error detection. If the receiver's checksum for a block is the same as its checksum at the sender, the receiver sends an acknowledgement byte to the sender. However, this strategy of recognizing each block will result in low performance, especially in the case of satellite connections with very long propagation delays.

A protocol corresponding to XMODEM that uses cyclic redundancy check is called XMODEM-CRC. Another is the XMODEM-1K, which transfers data in blocks of 1024 bytes. YMODEM is also an implementation of XMODEM. It includes all the features of XMODEM-1K, and adds a batch file transfer mode for sending a set of files during a single session.

ZMODEM is the most effective version of XMODEM, which does not require approval for every block. In fact, it simply requires retransmission of the damaged block. ZMODEM is very useful for block-based packet-switched networks. There is no need to recognize loopback packets, which greatly reduces the amount of traffic. It is an enhanced form of the Xmodem file transfer protocol that not only transmits larger data, but also has a lower error rate. Contains a feature called checkpoint restart that resumes transmissions from a breakpoint rather than from the beginning if the communication link is interrupted during data transfer.

Search Zmodem from the SecureCRT help topic and you will find the following description of Zmodem: Zmodem is a full-duplex file transfer protocol that supports fast data transfer rates and effective error detection. Zmodem is very user friendly, Zmodem supports multiple file (“batch”) transfers, and allows the use of wildcards when specifying filenames. Zmodem also supports resuming most prior Zmodem file transfer attempts.

Corresponding to the rz command, the sz command can be used to download files from a Linux server to the local.

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. (Force sender to escape all control characters; normally XON, XOFF, DLE, CR-@-CR, and Ctrl-X are escaped.)

If you want to ensure that the uploaded file content is saved on the server side and original The files are consistent. It is best to set these two flags at the same time, as follows:

rz -be

When this command is executed, a file selection dialog box will pop up, select the file to be uploaded. After the file, click OK and you can start the upload process. The speed of the upload depends on the state of the network at the time.

If the execution shows “0 error , the file upload is successful, and the other displays indicate that there is a problem with the file upload.

In some versions of Linux, execute the rz command " command not found", you can find lrzsz*.rpm to install in the installation disk.

Using examples

Example 1 Uploading a local jdk installer to a Linux server

The code is as follows:

[root@qzt196 setup]# rz - Be

rz waiting to receive.

Starting zmodem transfer. Press Ctrl+C to cancel.

Transferring jdk-6u21-linux-i586-rpm.bin. .

100% 77628 KB 137 KB/s 00:09:23 0 Error

[root@qzt196 setup]# ls -l jdk-6u21-linux-i586-rpm.bin

-rw-r--r-- 1 root root 79491215 06-25 07:06 jdk-6u21-linux-i586-rpm.bin

[root@qzt196 setup]#

Example 2 Uploading the local ant installer to the Linux server

The code is as follows:

[root@qzt196 setup]# rz -be

rz waiting to receive .

Starting zmodem transfer. Press Ctrl+C to cancel.

Transferring apache-ant-1.8.1-bin.tar.gz. .

100% 8071 KB 115 KB/s 00:01:10 0 Error

[root@qzt196 setup]#

Example 3 Cancel when selecting a file

The code is as follows:

[root@qzt196 ~]# rz -be

rz waiting to receive.

Starting zmodem transfer. Press Ctrl+C to cancel.

[root@qzt196 ~]#

Example 4 Press Ctrl+C during file upload

The code is as follows:

[root@qzt196 ~ ]# rz -be

rz waiting to receive.

Starting zmodem transfer. Press Ctrl+C to cancel.

Transferring apache-tomcat-5.5.31.tar.gz. .

1% 85 KB 10 KB/s 00:12:32 ETA 0 Error

rz: apache-tomcat-5.5.31.tar.gz removed.

[ Root@qzt196 ~]#

Example uploading multiple files at once

The code is as follows:

[root@qzt196 ~]# rz -be

rz waiting to receive.

Starting zmodem transfer. Press Ctrl+C to cancel.

Transferring applink.c. .

100% 2 KB 2 KB/s 00:00:01 0 Error

Transferring arguments.cpp. .

100% 2 KB 2 KB/s 00:00:01 0 Error

Transferring buffer.cpp. .

100% 825 bytes 825 bytes/s 00:00:01 0 Error

Transferring build. .

100% 1 KB 1 KB/s 00:00:01 0 Error

Bulk.cpp. is being transferred. .

100% 2 KB 2 KB/s 00:00:01 0 Error

The above is an example of the rz command in Linux. With these examples, you can learn more about the rz command. The specific usage allows you to flexibly apply the rz command when operating a Linux system.

Copyright © Windows knowledge All Rights Reserved