How to transfer data between Windows and Linux|How to transfer data between two Linux

Abstract: We rented a server, and then we want to upload the project we wrote to our own Linux server, so how should we upload it? What if we want to download some data from the server? Reading this article will tell you the answer.

1. Upload data to the server

There are many ways to upload data from a local computer to a Linux server, and here are the two simplest ones.

The first one: we can install the lrzsz software on the server, and then we enter the command rz on the server, a window will pop up, and we can upload.

The second type: we don't need to install anything, we can upload data to the server through the scp command.

scp "/d/data.txt" root@ip:/root

The above command means: we upload the data.txt file under the D drive to the /root directory of the server.

If we want to upload all files in the entire directory, then the following command can be used.

scp -r "/d/works/projects" root@ip:/root

Indicates to /d/works/projectsupload all the files in to /rootthe directory of the server.

You can not specify root

Note: If there are special characters such as spaces in the path, they need to be enclosed in double quotes. If there are no special characters then the double quotes may not be used.

2. Download data from the server

The first one: the lrzsz software is required to be installed in the server.

sz

The second: use the scp command directly.

scp root@ip:/root/data.txt "/d/works"

The above command means to /rootdownload from the server data.txtin the local computer /d/works.

If you are downloading the data in the entire directory, you can use the following command.

scp -r root@ip:/root "/d"

The above command means to /rootdownload all the data in the server to the D drive of the local computer.

3. Description

After my experiments, I found that using the scp command directly in cmd is very unstable. I recommend you to use git bash here.

scp can not only be used to transfer data between Windows and Linux, but also can be used to transfer data between Linux.

More content can click here

Guess you like

Origin blog.csdn.net/qq_43907505/article/details/130533757