600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > mac os如何使用rz sz

mac os如何使用rz sz

时间:2019-12-05 01:28:21

相关推荐

mac os如何使用rz sz

1.什么是rz、sz

在线上真实生产环境中总会有上传文件到服务器,以及从服务器下载文件的需求,rz、sz应用广泛,由于发送和接收都是在服务器上进行的。

所以~

rz:received(接收),意味着向服务器上传。

sz:send(发送),意味着从服务器下载。

2.安装iterm2

个人感觉mac os上比较好用的终端软件iterm2

下载地址:/

3.安装rz、sz

rz、sz需要在mac和线上服务器同时安装

1) 在mac上

使用以下命令安装

brew install lrzsz

如果你的mac自带的或者是iterm的终端提示你没有brew这个命令,可以使用以下命令进行安装

ruby -e "$(curl -fsSL /Homebrew/install/master/install)"

安装完成后,就可以使用命令进行第一步,安装lrzsz

然后需要配置rz、sz

cd /usr/local/binvim iterm2-recv-zmodem.sh

脚本内容如下

#!/bin/bash# Author: Matt Mastracci (matthew@)# AppleScript from /questions/4309087/cancel-button-on-osascript-in-a-bash-script# licensed under cc-wiki with attribution required # Remainder of script public domainosascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTermif [[ $NAME = "iTerm" ]]; thenFILE=`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)&\"\")"`elseFILE=`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)&\"\")"`fiif [[ $FILE = "" ]]; thenecho Cancelled.# Send ZModem cancelecho -e \\x18\\x18\\x18\\x18\\x18sleep 1echoecho \# Cancelled transferelsecd "$FILE"/usr/local/bin/rz -E -e -bsleep 1echoechoecho \# Sent \-\> $FILEfi

另外一个配置文件

vim iterm2-send-zmodem.sh

内容如下

#!/bin/bash# Author: Matt Mastracci (matthew@)# AppleScript from /questions/4309087/cancel-button-on-osascript-in-a-bash-script# licensed under cc-wiki with attribution required # Remainder of script public domainosascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTermif [[ $NAME = "iTerm" ]]; thenFILE=`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)&\"\")"`elseFILE=`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)&\"\")"`fiif [[ $FILE = "" ]]; thenecho Cancelled.# Send ZModem cancelecho -e \\x18\\x18\\x18\\x18\\x18sleep 1echoecho \# Cancelled transferelse/usr/local/bin/sz "$FILE" -e -bsleep 1echoecho \# Received $FILEfi

并给iterm2加满权限

chmod 777 iterm2-*

然后在iterm2的配置中添加对应的这两个配置

需要在iterm2的Profiles -> 要使用的会话(这里是堡垒机)

Regular expression: rz waiting to receive.\*\*B0100Action: Run Silent CoprocessParameters: /usr/local/bin/iterm2-send-zmodem.shRegular expression: \*\*B00000000000000Action: Run Silent CoprocessParameters: /usr/local/bin/iterm2-recv-zmodem.sh

添加完成后,点击close即可

2) 服务器端

我们同时需要在服务器端安装rz、sz,使用如下命令

yum install lrzsz ##公司yum源中已经包含该rpm包

4.使用rz、sz

1) 下载一个文件

sz filepath/file

2) 上传一个文件

rz

然后会弹出一个对话框,选择要上传的文件。

bingo

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。
相关阅读
mac使用rz sz

mac使用rz sz

2024-04-24

Mac 使用 sz 和 rz

Mac 使用 sz 和 rz

2018-07-17

Mac 下使用rz/sz

Mac 下使用rz/sz

2023-08-03

Mac 使用rz sz 命令

Mac 使用rz sz 命令

2018-11-08