brew lrzsz安装,服务器和mac本地传输文件

一、安装brew

  1. 确认安装ruby

apt-get install curl -y
apt-get install ruby-full -y
apt-get install lrzsz

which ruby

ruby --version

  1. 安装brew

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. 添加环境变量

Add Homebrew to your PATH in /Users/a58/.zprofile:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/a58/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Run brew help to get started

  1. 确认

brew --version

二、安装lrzsz

  1. brew install lrzsz

  2. /usr/local/bin 下新增两个文件

iterm2-send-zmodem.sh

iterm2-recv-zmodem.sh

具体内容参考:https://github.com/aikuyun/iterm2-zmodem

  1. 给上面的两个文件添加777权限

  2. 设置iterm2的Trigger特性

profiles->openProfiles->editProfiles->Advanced->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
  1. 服务器传文件到本地

sz filename

  1. 本地传文件到服务器

rz -bey

  1. 遇到问题

如果在第一次进行sz,rz时报错,可以点击错误日志进行查看。如果是/usr/local/bin/sz或者rz不存在,则改成存在的目录即可。which sz/rz可以查看位置。

猜你喜欢

转载自blog.csdn.net/weixin_43870390/article/details/131069793