In a cross-platform work environment, it is often necessary to transfer files from a Windows system to a Linux server.
1. Use SCP commands
- SCP (Secure Copy Protocol) is a network protocol based on SSH (Secure Shell) that is used to securely copy files between computers.
- It isThe easiestOne of the methods is that there is no need to install additional software on Windows.
Open a command prompt or PowerShell and use the following commands:
scp [Source file path] username@serverIP:Target path
For example:
scp C:\Users\YourName\Documents\ [email protected]:/home/username/
2. Build a Web Service
Building a simple web service, it is recommended to use Python + Tornado, which can quickly build a simple http service
2.1 Building a Web Server
It is a little complicated, and I can't finish it here. I recommend referring to the construction tutorial:
Python tornado uses 40 lines of code to build database interactive web pages to achieve rapid full-stack development
2.2 Upload files from Windows
Just as simple as using a web page
3. Use wget to download the link
Wget is a command line tool for downloading files from the network.
By using wget on a Linux server, you can download files from the network.
3.1 Generate link
You can generate a file exclusive link by sharing files, uploading files to websites, uploading them to OSS, COS, etc.
3.2 Using wget on Linux server
Download the file using the wget command
wget / -O /path/to/destination/
4. Comparison
characteristic | SCP | Python builds the web | wget |
---|---|---|---|
definition | SSH-based file transfer tool | Building simple HTTP service through Python | The command line downloads the file from the network. |
Security | high | medium | medium |
speed | Relatively slow | Faster | Faster |
Ease of use | Need a basic | Simple | Need a basic |
Configuration difficulty | Simple | Relatively complex | Simple |
Applicable scenarios | High security, small files | Large files, batch files, non-technical users | Large file, support for breakpoint continuous transmission |
Cross-platform | Good support | Good support | Linux only |
automation | Can be integrated into scripts | Can be integrated into scripts | Can be integrated into scripts |
Additional advantages | Can maintain file permissions and properties | Simple and easy to deploy | Support recursive download |
shortcoming | Slow speed | Requires stable web service support | File upload is not supported |
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.