> For the complete documentation index, see [llms.txt](https://jun-wang.gitbook.io/learnjava/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jun-wang.gitbook.io/learnjava/xiaolti-sheng/windows-yu-linux-fu-wu-qi-chuan-wen-jian.md).

# 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服务器传输文件，只需要把上面的两个箭头 > 和 < 反过来写就行了。
```
