iterm2

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

 iterm2使用ohmyzsh自动补全工具

查看系统当前使用的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 

 自动补齐插件

incr.zsh 补全插件

下载此插件:

$ 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  密码

第二篇记住密码文章

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值