mac系统的终端支持sz rz

sanlanlan 2019-1-24 标签: linux 浏览:118 评论:0


mac系统的终端支持sz,rz

使用场景:如果是跳板机链接服务器,那么服务器的文件没办法直接下载下来,这时候就可以使用 sz, rz 解决上传下载问题

步骤:
1.mac 安装 homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

具体参考官网步骤:https://brew.sh/


2.安装 iTerm2,参考官网


3.安装 lrzsz

brew install lrzsz
ln -s /usr/local/Cellar/lrzsz/0.12.20/bin/sz
ln -s /usr/local/Cellar/lrzsz/0.12.20/bin/rz

4. cd /usr/local/bin

下载 iterm2-send-zmodem.sh iterm2-recv-zmodem.sh 这2个文件

这2个地址已经404 

sudo wget https://raw.github.com/mmastrac/iterm2-zmodem/master/iterm2-send-zmodem.sh
sudo wget https://raw.github.com/mmastrac/iterm2-zmodem/master/iterm2-recv-zmodem.sh

用新的地址:

curl -L -o /usr/local/bin/iterm2-recv-zmodem.sh https://github.com/RobberPhex/iterm2-zmodem/raw/master/iterm2-recv-zmodem.sh
curl -L -o /usr/local/bin/iterm2-send-zmodem.sh https://github.com/RobberPhex/iterm2-zmodem/raw/master/iterm2-send-zmodem.sh

修改文件权限,如果不行,改成777.
chmod a+x /usr/local/bin/iterm2-recv-zmodem.sh /usr/local/bin/iterm2-send-zmodem.sh


5.配置iTerm2

iTerm2 --> Profiles --> Open Profiles --> Edit Profiles --> Advanced --> Edit 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

6.重启 iterm2

注意iterm2 配置的shell, 有可能shell 被修改,导致 命令访问不到


PS:注意服务器要支持 sz 命令,必须安装 lrzsz

参考文件:
https://www.robberphex.com/use-zmodem-at-macos/

本文相关标签: rz sz

发表评论: