工作中,有时会在Windows和Linux系统之间传文件,主要使用三种办法,WinSCP的界面非常丰富,适合批量传输文件;Tabby用于ssh连接,偶尔可以用SFTP传输文件,也有图形界面,还算方便。

今天要介绍的软件是Wormhole,不需要用到SCP或SFTP协议,只要你能上网即可。

安装Wormhole

Windows系统里需要提前安装Python环境,然后执行:

pip install magic-wormhole

提醒注意:包名是 magic-wormhole,不是 wormhole!

Linux系统里的安装方法(以Ubuntu为例):

sudo apt install magic-wormhole  

发送文件

wormhole send shenlb.me.txt

会给出一段提示:

Sending 20250721 Bytes file named 'shenlb.me.txt'
Wormhole code is: 61-disbelief-deckhand
On the other computer, please run:

wormhole receive 61-disbelief-deckhand

Windows里的命令行程序还会同时提供一个字符拼成的二维码,例如:

alt text

接收文件

照抄提示的命令即可,密码是2个数字和2个单词。

wormhole receive 61-disbelief-deckhand

如果连接成功的话,会让你确认是否下载。

Receiving file (20250721 Bytes) into: 'shenlb.me.txt'
ok? (Y/n):
Receiving (->relay:tcp:magic-wormhole-transit.debian.net:4001)..
100%|██████████████████████████████████████████| 4.00/4.00 [00:00<?, ?B/s]
Received file written to shenlb.me.txt

其它

我对这种两个单词的编码方式有点好奇,翻到magic-wormhole的源代码,原来这个东西的名称叫PGP word list