mac Iterm2 安装

  1. 下载iTerm2
    官网下载:https://www.iterm2.com/

  2. 替换背景图片
    打开路径:iterm2 -> Preferences -> Profiles -> window -> Background Image
    选择一张自己喜欢的壁纸即可
    可以通过Blending调节壁纸的透明度: 透明度为0的时候,背景变为纯色(黑色)

  3. SSH 自动登录
    1、打开路径:iterm2 -> Preferences -> Profiles -> General -> Command
    在这里插入图片描述

2、打开路径:iterm2 -> Preferences -> Profiles -> General -> Advanced->Tiggers->Edit 配置

  1. 公钥登陆 配置
    1、编写本地 SSH 配置文件:~/.ssh/config
    假如我的服务端主机与主机别名(方便自己记忆而起的别名)列表如下:
    192.168.120.1 host1

那么我的本地~/.ssh/config文件配置如下:
Host host1 #别名
Hostname 192.168.120.1 #服务器地址
Port 22 #服务器 SSH 服务端口
User root #服务端的用户名
IdentityFile ~/.ssh/priKeys/host1_key #对应本地的私钥文件路径

各配置项的意义见上面的注释内容,这样一来,我就可以用 主机别名 直接登录远程服务器了。比如通过 SSH 公钥登录root@192.168.110.4,以下命令即可:
➜ ssh host1

这样,ssh 命令会自动根据~/.ssh/config中的配置项,寻找到jiayutest这一个私钥文件,然后拿它去登录root@192.168.110.4

注:修改秘钥文件权限 chmod 600 你的密钥文件

  1. rz sz 命令 配置iterm2 Tiggers
    选择Profiles > Default > Advanced > Triggers > Edit

发送 sz

Regular expression:**B0100
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-send-zmodem.sh

接收 rz

Regular expression:**B00000000000000
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-recv-zmodem.sh
配置完成如下:
在这里插入图片描述

iterm2-send-zmodem.sh 内容

#!/bin/bash

iterm2-send-zmodem.sh

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 [[ KaTeX parse error: Expected 'EOF', got '#' at position 44: …Cancelled. #̲ Send ZModem ca…FILE" -e -b
sleep 1
echo
echo # Received $FILE
fi

iterm2-recv-zmodem.sh

#!/bin/bash

iterm2-recv-zmodem.sh

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 [[ KaTeX parse error: Expected 'EOF', got '#' at position 44: …Cancelled. #̲ Send ZModem ca…FILE"
/usr/local/bin/rz -E -e -b
sleep 1
echo
echo
echo \ Sent -> $FILE
fi

注意
1、如果执行 chsh -s /bin/zsh 命令 会导致 .bash_profile 文件中配置的alias 失效
2、如果配置自动登录采用 expect 方式会导致rz 无法上传文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值