Mac下安装配置rz sz

安装iTerm2

  • 建议去官网下载 http://www.iterm2.com/
  • 下载好后安装即可

安装rz sz

安装rz sz 前的准备 安装brew

一般我们在linux系统上,会使用软件包管理器yum或者apt,而homebrew简称brew,它的功能类似yum或者apt,它是max osx上的软件包管理工具。

  • 安装homebrew 只需要下面一条语句即可
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装成功后输入 brew 查看是否有提示信息
MacintoshdeMacBook-Pro:~ cmg$ brew
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA

Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh
  • 如果看到如上信息,则表示brew安装成功了。
安装 lrzsz
  • 使用如下命令即可
brew install lrzsz
配置rz sz 进行上传下载
  • 进入到. /usr/local/bin 目录下
cd /usr/local/bin
  • 在 /usr/local/bin 目录下需要创建两个文件

创建第一个文件

vim iterm2-recv-zmodem.sh

复制以下内容到 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"
    /usr/local/bin/rz -E -e -b
    sleep 1
    echo
    echo
    echo \# Sent \-\> $FILE
fi

创建第二个文件

vim iterm2-send-zmodem.sh

复制以下内容到 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
    /usr/local/bin/sz "$FILE" -e -b
    sleep 1
    echo
    echo \# Received $FILE
fi 
  • 将文件写好后保存好,使用如下命令添加权限
chmod 777 iterm2-*

iTerm2 配置添加rz sz 功能

同时按 cmd 和 , 键

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

配置项:

Regular expression   Action        Parameters

**B0100        Run Silent Coprocess  /usr/local/bin/iterm2-send-zmodem.sh

**B00000000000000  Run Silent Coprocess  /usr/local/bin/iterm2-recv-zmodem.sh

  • 点击+号,输入下图内容
    在这里插入图片描述
    右侧的instant一定要勾选上!!!
    右侧的instant一定要勾选上!!!
    右侧的instant一定要勾选上!!!

点击Close

到此rz sz安装配置就完成了

rz 和 sz 的使用

  • rz 上传功能
    在bash中,也就是iTerm2终端输入rz 就会弹出文件选择框,选择文件 choose 就开始上传,会上传到当前目录。
  • sz 下载功能
    sz fileName(你要下载的文件的名字) 回车。
    会弹出窗体,选择要保存的地方即可。
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Linux系统上安装rzsz命令,可以通过安装lrzsz软件包来实现。首先,确保你的系统已经连接到互联网。然后,可以使用以下两种方法之一进行安装。 1. 使用yum安装: 打开终端并以root用户身份登录。运行以下命令来安装lrzsz软件包: ``` yum install lrzsz ``` 系统会提示你确认是否要安装,输入y并按下回车键继续安装安装完成后,rzsz命令就会自动安装在系统中。 2. 使用wget安装: 打开终端并以root用户身份登录。运行以下命令来下载lrzsz软件包: ``` wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz ``` 下载完成后,运行以下命令来解压缩文件: ``` tar -zxvf lrzsz-0.12.20.tar.gz ``` 进入解压缩后的目录: ``` cd lrzsz-0.12.20 ``` 运行以下命令来编译和安装lrzsz: ``` ./configure make make install ``` 安装完成后,rzsz命令就会安装在系统中。 在安装完成后,你就可以在Linux系统上使用rzsz命令来上传和下载文件了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [Linux安装rz命令和sz命令方法教程](https://blog.csdn.net/gla2018/article/details/128132113)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值