什么是Babun?这就不做普及了,Google一下有更详细的资料说明,相信对Cygwin不陌生的朋友能很快上手。官方给出的说明是:
一个你会喜欢的Windows shell!
安装
从Babun的官方网站下载最新安装包,解压后运行install.bat脚本,安装完成后几分钟内Babun会自动弹出一个shell命令窗口。程序被安装到 %USERPROFILE%\.babun 这个目录。
下次运行它只需 Win+R 调出运行对话框输入babun即可。
一些常用的用法见这里
常用的设置
命令窗口在命令行头部右键选中Options可以进行设置。
Git命令行执行:
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
快捷键及操作
常用的一般操作:
通配符搜索:
ls -l **/*.sh,可以递归显示当前目录下的shell文件,文件少时可以代替find。使用 **/ 来递归搜索。
历史命令:
很多快捷键都是通用的,和Emacs等都是一样的:
常用的命令
oh-my-zsh常用的OMZ命令可以参考Cheatsheet
最常用的目录操作:
list all aliases
查看 ~/.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这样的命令的时候,加上输出转换:
ping | iconv -f GBK -t UTF-8
以上就是目前在使用的Windows下最好用的shell的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号