• 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友,商务沟通v:ai_draw
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

mac下配置 iterm2支持rz sz命令

Linux admin 5年前 (2018-12-07) 24959次浏览 已收录 0个评论 扫描二维码

之前也有配置iterm2的rz sz命令,最近也有用到就记录下,

配置很简单。主要按照如下(下载zmoden脚本):

https://github.com/mmastrac/iterm2-zmodem

首先安装lrzsz。

brew install lrzsz

ZModem integration for iTerm 2

This script can be used to automate ZModem transfers from your OSX desktop to a server that can run lrzsz (in theory, any machine that supports SSH), and vice-versa.

The minimum supported iTerm2 version is 1.0.0.20120108

Troubleshooting

  • Sending a directory may fail: this is a known issue
  • If you are using tmux or some other terminal multiplexer (ie: screen), try using the -e option to sz and/or rz on your server to force escaping of more characters during transmission.
  • This tool may also fail if you are using expect or rlogin as it expects a mostly-clean 8-bit connection between the two parties.

Setup

  1. Install lrzsz on OSX: brew install lrzsz
  2. Save the iterm2-send-zmodem.sh and iterm2-recv-zmodem.sh scripts in /usr/local/bin/
  3. Set up Triggers in iTerm 2 like so:
    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

To send a file to a remote machine:

  1. Type rz on the remote machine
  2. Select the file(s) on the local machine to send
  3. Wait for the coprocess indicator to disappear

The receive a file from a remote machine

  1. Type sz filename1 filename2 … filenameN on the remote machine
  2. Select the folder to receive to on the local machine
  3. Wait for the coprocess indicator to disappear

Future plans (patches welcome)

  • Visual progress bar indicator

 

将iterm2-send-zmodem.sh 和 iterm2-recv-zmodem.sh脚本下载下来并放到/usr/local/bin/目录下,注意赋予脚本执行的权限

 

如图,打开iterm2

同时按 command和,键

Profiles  –  Default – Advanced – Triggers的Edit按钮,

在弹出的界面配置以下参数

mac下配置 iterm2支持rz sz命令

 

mac下配置 iterm2支持rz sz命令

 

可以正常向服务器上传文件了。

mac下配置 iterm2支持rz sz命令

喜欢 (1)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址