版权声明:本文为twowinter原创文章,请联系微信公众号twowinter,未经博主允许不得转载。 https://blog.csdn.net/iotisan/article/details/88559545
前言
要和Linux服务器传输文件,一个非常简单的办法是使用 lrzsz。Windows下有很多办法,MAC下目前都是靠 mmastrac 编写的一个 Zmodem 脚本。
https://github.com/mmastrac/iterm2-zmodem
今天刚做完了实验,做个记录,在他 readme 的基础上做了一点命令丰富。
本文作者twowinter,转载请注明作者:http://blog.csdn.net/iotisan/
1 安装方法
- Install lrzsz on OSX:
brew install lrzsz
- Save the
iterm2-send-zmodem.sh
anditerm2-recv-zmodem.sh
scripts in/usr/local/bin/
$ sudo curl -O https://raw.githubusercontent.com/mmastrac/iterm2-zmodem/master/iterm2-send-zmodem.sh
$ sudo curl -O https://raw.githubusercontent.com/mmastrac/iterm2-zmodem/master/iterm2-recv-zmodem.sh
$ sudo chmod 777 /usr/local/bin/iterm2-*
小能手在这边出现过问题,卡住了好久,iTerm2 提示如下:
Coprocess terminated with output on stderr
这是由于下载的脚本有问题,需要重新下载下。
- Set up Triggers in iTerm 2 like so:
How to Create a Trigger
Regular expression: rz waiting to receive.\*\*B0100 Action: Run Silent Coprocess Parameters: /usr/local/bin/iterm2-send-zmodem.sh Instant: checked Regular expression: \*\*B00000000000000 Action: Run Silent Coprocess Parameters: /usr/local/bin/iterm2-recv-zmodem.sh Instant: checked
2 使用办法
To send a file to a remote machine:
- Type
rz
on the remote machine - Select the file(s) on the local machine to send // 一切顺利的话,本地机子是会弹出一个文件浏览选择框。
- Wait for the coprocess indicator to disappear
The receive a file from a remote machine
- Type
sz filename1 filename2 … filenameN
on the remote machine - Select the folder to receive to on the local machine
- Wait for the coprocess indicator to disappear