# Windows与Linux服务器传文件

有的时候由于内网限制，开发及其不能直接通过ftp连接线上服务器，这个时候如果想要互传文件的话可以使用netcat。

首先windows先安装netcat：

## 1. **下载**

<https://eternallybored.org/misc/netcat/>，LZ下载的是`netcat 1.12`，解压。

## 2. 安装

很简单，将解压出来的所有文件copy到`C:\Windows\System32`文件夹下。

## 3. 使用

打开cmd：

```
# 1.Linux服务器向windows传输文件
# Windows上命令如下
nc -l -p {port} > file.log
# Linux服务器命令如下
nc {Windows IP} {port} < file.log
# 这样就把Linux上的file.log文件原封不动的传输到Windows本地上了。

# 2.Windows向Linux服务器传输文件，只需要把上面的两个箭头 > 和 < 反过来写就行了。
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jun-wang.gitbook.io/learnjava/xiaolti-sheng/windows-yu-linux-fu-wu-qi-chuan-wen-jian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
