首页 > 数据库 > 数据库开发技术 > 目前在使用的Windows下最好用的shell
目前在使用的Windows下最好用的shell
什么babun?这是就不做普及了,Google一下有更详尽的资料说明,相信对cygwin不陌生的朋友能很快上手。 官网给出的说明是:
到Babun的官网下载最新的安装包,解压后运行 install.bat脚本,几分钟后安装完成后babun会自动弹出一个shell命令窗口。程序被安装到了 %USERPROFILE%\.babun 这个目录。
下次运行它只需 Win+R 调出运行对话框输入babun即可。
一些常用的用法见 这里
配置文件在 ~/.zshrc
在命令行头部右键选中Options可以设置。
Looks/Transparency 选择Low并勾选Opaque when focused 来设置窗口的透明度
Keys里勾选Backspace sends ^H 这样按Ctrl H的时候可以向前删除字符
命令行执行:
git config --global user.name "yourname"git config --global user.email "yourname@abc.com"
可以用pact命令安装软件包,比如:
pact install arj
通过pact --help可以查看完整的用法。
默认的python里没有带pip,可以这样安装:
wget https://bootstrap.pypa.io/get-pip.py -O - | python
常用的一般操作:
经过上面的设置后,可以通过 Ctrl+H 来删除字符
Alt+Shift+Enter 可以全屏
Ctrl+Insert 复制 & 左键选中复制
Shift+Insert 粘贴 & 右键粘贴
Ctrl+Click 可以打开一个车目录或文件或链接
Ctrl+l 清屏
tab 补全
通配符搜索:ls -l */.sh,可以递归显示当前目录下的 shell 文件,文件少时可以代替 find。使用 **/ 来递归搜索
历史命令:
可以用 !!来执行上一条命令
使用 ctrl-r 来搜索命令历史记录
更智能的历史命令。在用或者方向上键查找历史命令时,zsh支持限制查找。比如,输入ls,然后再按方向上键,则只会查找用过的ls命令
很多快捷键都是通用的,和 Emacs 等都是一样的
Ctrl + u:清空当前行
Ctrl + a:移动到行首
Ctrl + e:移动到行尾
Ctrl + f:向前移动
Ctrl + b:向后移动
Ctrl + p:上一条命令
Ctrl + n:下一条命令
Ctrl + r:搜索历史命令
Ctrl + y:召回最近用命令删除的文字
Ctrl + h:删除光标之前的字符
Ctrl + d:删除光标所指的字符
Ctrl + w:删除光标之前的单词
Ctrl + k:删除从光标到行尾的内容
Ctrl + t:交换光标和之前的字符
open . 打开当前目录
命令 | pbcopy 通过管道加在命令行后可以将输出拷贝到系统的剪贴板上;同理,pbpaste 把剪贴板中的文本输出
常用的OMZ命令可以参考 Cheatsheet
最常用的目录操作:
| Alias | Command |
|---|---|
| alias | list all aliases |
| .. | cd .. |
| ... | cd ../.. |
| .... | cd ../../.. |
| ..... | cd ../../../.. |
| / | cd / |
| ~ | cd ~ |
| cd +n |
switch to directory number n
|
| 1 | cd - |
| 2 | cd +2 |
| 3 | cd +3 |
| 4 | cd +4 |
| 5 | cd +5 |
| 6 | cd +6 |
| 7 | cd +7 |
| 8 | cd +8 |
| 9 | cd +9 |
| md | mkdir -p |
| rd | rmdir |
| d | dirs -v (lists last used directories) |
See ~/.oh-my-zsh/lib/directories.zsh
Git的操作命令比较多,具体参考Cheatsheet,下面列出最常用的:
| Alias | Command |
|---|---|
| g | git |
| ga | git add |
| gaa | git add --all |
| gb | git branch |
| gba | git branch -a |
| gbd | git branch -d |
| gbr | git branch --remote |
| gcam | git commit -a -m |
| gcb | git checkout -b |
| gcf | git config --list |
| gcm | git checkout master |
| gcd | git checkout develop |
| gcmsg | git commit -m |
| gco | git checkout |
| gd | git diff |
| gdca | git diff --cached |
| gf | git fetch |
| gfo | git fetch origin |
| gg | git gui citool |
| ggpull | git pull origin $(current_branch) |
| ggl | git pull origin $(current_branch) |
| ggpush | git push origin $(current_branch) |
| ggp | git push origin $(current_branch) |
| gl | git pull |
| glg | git log --stat --max-count = 10 |
| glgg | git log --graph --max-count = 10 |
| glgga | git log --graph --decorate --all |
| glo | git log --oneline --decorate --color |
| glog | git log --oneline --decorate --color --graph |
| gm | git merge |
| gp | git push |
| grv | git remote -v |
| gss | git status -s |
| gst | git status |
| gup | git pull --rebase |
可以简化命令输入,在 .zshrc 中添加alias shortcut='this is the origin command'一行就相当于添加了别名在命令行中输入 alias 可以查看所有的命令别名
终端默认用的mintty,其实对中文支持的很好了,比如中文的目录、文件名都没有问题。唯一有问题的是调用windows自带的一些命令的时候,比如ping,结果会显示乱码,这是因为Babun默认用的是UTF-8,而Windows默认的编码是GBK。当然可以把Babun设置成GBK但这样执行UTF-8的脚本(比如Groovy)输出的中文会有乱码。
建议Babun的默认编码还是UTF-8,在使用ping这样的命令的时候,加上输出转换:
pint | iconv -f GBK -t UTF-8



原文作者:MavenTalk;如有侵权,请联系管理员删除。