iterm2 快捷键
1.新建窗口(分屏)
垂直分屏:command + d
水平分屏:command + shift + d
切换屏幕:command + option + 方向键
command T 创建一个新的窗口
command +左右箭头 左右切换
command W 删除当前窗口
control L 清屏
2.缩放窗口
**放大窗口**:command +
**缩小窗口**:command
**切换全屏**:command +enter
**恢复默认窗口**:command 0
**最小化**:command M
3.查找
**搜所历史命令**:ctrl +r
**查找**:command +f
**切换全屏**:command +enter
**查看剪贴板历史**:command +shift+h
https://www.csdn.net/tags/OtTaMg1sODU3NzQtYmxvZwO0O0OO0O0O.html
查看系统当前使用的shell
$ echo $SHELL
/bin/bash
查看系统是否安装了zsh
$ cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh
centos7默认情况下没安装zsh
用yum安装zsh
$ yum -y install zsh
查看shell列表
$ cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh
/bin/zsh
切换shell为zsh
$ chsh -s /bin/zsh
Changing shell for root.
Shell changed.
重启服务器后,可使用reboot
重启后,查看当前shell
$ echo $SHELL
/bin/zsh
安装 oh my zsh
oh-my-zsh源码是放在github上,先确保你的机器上已安装了git(没有安装一样使用yum命令安装即可:yum -y install git)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
成功界面:
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us at https://twitter.com/ohmyzsh.
p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.
接下来只需简单的配置,就可以享受oh-my-zsh
的强大
修改主题:
$ vim ~/.zshrc
将ZSH_THEME
改成ys
ZSH_THEME="ys"
更新配置:
$ source ~/.zshrc
自动补齐插件
下载此插件:
$ wget http://mimosa-pudica.net/src/incr-0.2.zsh
然后进入oh-my-zsh插件文件夹,路径为~/.oh-my-zsh/plugins/ ,
在plugins文件夹下新建incr文件夹 并将下载的incr.zsh文件拷贝到该目录下,
在~/.zshrc
文件末尾加上这段:(vim ~/.zshrc)
source ~/.oh-my-zsh/plugins/incr/incr*.zsh
更新配置:
$ source ~/.zshrc
然后就能立马自动补全了
记住密码
由于使用的是expect来实现自动登录远程机器,所以先看一下是否有expect环境,没有的话安装一下:
第一步:在 iterm2的home directory 一般/usr/local/bin目录下新建一个脚本文件iterm2ssh.sh(名字随便取)
#!/usr/bin/expect
set timeout 30
spawn ssh -p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2]
expect "*password:"
send "[lindex $argv 3]\n"
interact
上面第一行注释一定放第一行
其中 #!/usr/bin/expect 为你的expect地址也就是上面查找出来的set timeout 30 为expect阻塞超时时间
$argv 0 为参数占位符
第二步: 修改iterm2ssh.sh的权限
chmod 777 iterm2ssh.sh
如图 在该位置依次输入你的脚本 端口 用户名 主机和密码保存,然后就可以使用了
iterm2ssh.sh 端口 用户名 服务器IP 密码