当前位置: 首页 > news >正文

Mac iTerm2 rz sz

1、安装brew(找了很多🔗,就这个博主的好用)

Mac如何安装brew?_行走的码农00的博客-CSDN博客_mac brew

2、安装lrzsz

brew install lrzsz  

检查是否安装成功

brew list

定位lrzsz的安装目录

brew list lrzsz

执行结果如下:

 3、配置rz sz 进行上传下载

进入lrzsz的安装目录bin下

cd /opt/homebrew/bin

创建两个文件:

$FILE 后面的配置路径为:lrzsz的安装目录bin

sudo vim iterm2-recv-zmodem.sh

#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
    FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
    FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi

if [[ $FILE = "" ]]; then
    echo Cancelled.
    # Send ZModem cancel
    echo -e \\x18\\x18\\x18\\x18\\x18
    sleep 1
    echo
    echo \# Cancelled transfer
else
    cd "$FILE"
    /opt/homebrew/bin/rz -E -e -b
    sleep 1
    echo
    echo
    echo \# Sent \-\> $FILE
fi

sudo vim iterm2-send-zmodem.sh

#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
    FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
    FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi
if [[ $FILE = "" ]]; then
    echo Cancelled.
    # Send ZModem cancel
    echo -e \\x18\\x18\\x18\\x18\\x18
    sleep 1
    echo
    echo \# Cancelled transfer
else
    /opt/homebrew/bin/sz "$FILE" -e -b
    sleep 1
    echo
    echo \# Received $FILE
fi

给予权限:

chmod -R 777 iterm2-recv-zmodem.shchmod -R 777 iterm2-send-zmodem.sh

4、iTerm2 配置添加rz sz 功能

点击 iTerm2 的设置界面 Perference-> Profiles -> Default -> Advanced -> Triggers 的 Edit 按钮

 配置内容如下:

第一行:

rz waiting to receive.\*\*B0100

Run Silent Coprocess

/opt/homebrew/bin/iterm2-send-zmodem.sh

第二行:

\*\*B00000000000000

Run Silent Coprocess

/opt/homebrew/bin/iterm2-recv-zmodem.sh

Instant 打钩的话,不需要重启item

 然后就可以使用rz、rz命令啦~  

http://www.lryc.cn/news/23602.html

相关文章:

  • 高通平台开发系列讲解(Sensor篇)Gsensor基础知识
  • 图像处理实战--Opencv实现人像迁移
  • OnlyOffice验证(二)在Centos7上部署OnlyOffice编译结果
  • 6.补充和总结【Java面试第三季】
  • 基于ssm框架大学生社团管理系统(源码+数据库+文档)
  • vulnhub靶场NAPPING: 1.0.1教程
  • Docker基本介绍
  • 可用于标记蛋白质216699-36-4,6-ROX,SE,6-羧基-X-罗丹明琥珀酰亚胺酯
  • 高数:极限的定义
  • 大数据技术之Hadoop
  • 一文带你搞懂Go语言函数选项模式,Go函数一等公民。
  • Window.location 详细介绍
  • js侧滑显示删除按钮
  • Python - DIY - 使用dump取json某些键值对合成新的json文件
  • 深度剖析指针(中)——“C”
  • 论文阅读 | Video Frame Synthesis using Deep Voxel Flow
  • 我所理解的生活
  • debian 部署nginx https
  • SQL 层功能改进 - lookupJoin 的优化
  • 动态规划:鸣人的影分身
  • 如何为三星active2手表安装自己DIY的表盘
  • Android 项目必备(四十二)-->Android 多窗口模式
  • OpenHarmony的未来和如何做好一个开源社区
  • 二叉搜索树实现
  • 解决Spring Data Jpa 实体类自动创建数据库表失败问题
  • Elasticsearch:创建一个简单的 “你的意思是?” 推荐搜索
  • urllib之ProxyHandler代理以及CookieJar的cookie内存传递和本地保存与读取的使用详解
  • 华为造车锚定智选模式, 起点赢家赛力斯驶入新能源主航道
  • [oeasy]python0096_游戏娱乐行业_雅达利_米洛华_四人赛马_影视结合游戏
  • 使用python测试框架完成自动化测试并生成报告-实例练习