Use XShell to upload and download files (use sz and rz commands), super practical

With the help of XShell, you can use the linux command sz to easily download files from the server to the local, and use the rz command to upload local files to the server.

But first of all, your linux system needs to install the sz and rz commands, how do you know what you have installed?

sz: send the selected file to the local machine

rz: Running this command will pop up a file selection window, select a file locally and upload it to the Linux server

If there is this prompt, it means that it is not installed, so let’s install it by hand.

Install command:

yum install lrzsz

Among them, I used the following method to understand and remember sz and rz (it is easy to confuse in many cases):

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

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

        Remember, whether it is send or received, the action is initiated on the server. We are used to talking about uploading or downloading, but it is not necessary. To use these two commands, just think about whether you want to send the file from the server or receive it from the client.

        If you want to upload a file from the client to the server, the server will receive the file back. The logic is: I (client) upload, you (server) receive, use rz.

        If you want to download the file back from the server (to the client), the server will send the file. The logic is: I download (client), you (server) send, use sz.

        Well, finally summed up in one sentence:

I (client) upload, you (server) receive (RZ), I download (client), you (server) send (SZ).

---------------------------------------------------------------------------------------------------------------------------

sz usage:

Download a file sz filename 

Load multiple files sz filename1 filename2  

Download all files in dir directory, excluding folders in dir sz dir/*

rz usage:

After entering rz and pressing Enter, a file selection dialog box will appear, select the file to be uploaded, multiple files can be specified at a time, and the path to upload to the server is the directory where the rz command is currently executed.

Guess you like

Origin blog.csdn.net/wade1010/article/details/129387710