iterm2 拖拽上传或右键下载
安装 Shell Integration
使用
iTerm2登录远程主机菜单
iTerm2 > Install Shell Integration安装即可
vim ~/.bash_profile添加 以下代码, 顺序不能变
sh
export iterm2_hostname=mine-bjbj
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
mine-bjbj对应的是ip或者alias,alias就是本地电脑~/.ssh/config配置的别名, 例如下面的配置
sh
Host mine-bjbj
HostName xxx.xxx.xxx.xxx
User root
PreferredAuthentications publickey
IdentityFile /Users/shen/.ssh/id_rsa
IdentitiesOnly yes然后本地电脑也安装一下
菜单
iTerm2 > Install Shell Integration安装即可 不需要上面的配置了
参考: