安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| yum update && yum -y install zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# 配置文件
vim ~/.zshrc
plugins=(
git
npm
yarn
bower
yarn
yum
)
# 查看shell列表
cat /etc/shells
# 切换shell为zsh
chsh -s /bin/zsh
|
插件安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| # 更改 hosts
vim /etc/hosts
192.168.75.1 gitea.laijw.com
# 下载插件
cd ~/.oh-my-zsh/custom/plugins
# 外网
git clone https://github.com.cnpmjs.org/zsh-users/zsh-autosuggestions.git
git clone https://github.com.cnpmjs.org/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com.cnpmjs.org/wting/autojump.git
# autojump 安装
cd autojump && python install.py
# 按照提示粘贴到 ~/.zshrc 尾部
# 启用插件
vim ~/.zshrc
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
# 启用配置
source ~/.zshrc
|
~/.zshrc
1
2
3
4
5
6
7
8
9
10
11
| plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
[[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh
autoload -U compinit && compinit -u
|
常用快捷命令
1
2
| # git 三部曲
gaa && gcmsg "2019/12/31 周二 23:57:09.30 赖经纬" && ggp
|
Aliases
| Alias | Command | Description |
|---|
| ys | yum search | Search package |
| yp | yum info | Show package info |
| yl | yum list | List packages |
| ygl | yum grouplist | List package groups |
| yli | yum list installed | Print all installed packages |
| ymc | yum makecache | Rebuild the yum package list |
| yu | sudo yum update | Upgrade packages |
| yi | sudo yum install | Install package |
| ygi | sudo yum groupinstall | Install package group |
| yr | sudo yum remove | Remove package |
| ygr | sudo yum groupremove | Remove pagage group |
| yrl | sudo yum remove --remove-leaves | Remove package and leaves |
| yc | sudo yum clean all | Clean yum cache |
| gaa | git add –all | |
| gcmsg | git commit -m | |
| gp | git push | |
| ggpush | git push origin “$(git_current_branch)” | |
| gpsup | git push –set-upstream origin $(git_current_branch) | |
| gst | git status | |
| gl | git pull | |
| ggl | git pull origin $(current_branch) | |
| gpristine | git reset –hard && git clean -dfx | |
| y | yarn | The Yarn command |
| ya | yarn add | Install a package in dependencies (package.json) |
| yad | yarn add --dev | Install a package in devDependencies (package.json) |
| yap | yarn add --peer | Install a package in peerDependencies (package.json) |
| yb | yarn build | Run the build script defined in package.json |
| ycc | yarn cache clean | Clean yarn’s global cache of packages |
| yga | yarn global add | Install packages globally on your operating system |
| ygls | yarn global list | Lists global installed packages |
| ygrm | yarn global remove | Remove global installed packages from your OS |
| ygu | yarn global upgrade | Upgrade packages installed globally to their latest version |
| yh | yarn help | Show help for a yarn command |
| yi | yarn init | Interactively creates or updates a package.json file |
| yin | yarn install | Install dependencies defined in package.json |
| yls | yarn list | List installed packages |
| yout | yarn outdated | Check for outdated package dependencies |
| yp | yarn pack | Create a compressed gzip archive of package dependencies |
| yrm | yarn remove | Remove installed packages |
| yrun | yarn run | Run a defined package script |
| ys | yarn serve | Start the dev server |
| yst | yarn start | Run the start script defined in package.json |
| yt | yarn test | Run the test script defined in package.json |
| yuc | yarn global upgrade && yarn cache clean | Upgrade global packages and clean yarn’s global cache |
| yui | yarn upgrade-interactive | Prompt for which outdated packages to upgrade |
| yup | yarn upgrade | Upgrade packages to their latest version |
npmg | npm i -g | Install dependencies globally |
npmS | npm i -S | Install and save to dependencies in your package.json |
npmD | npm i -D | Install and save to dev-dependencies in your package.json |
npmE | PATH="$(npm bin)":"$PATH" | Run command from node_modules folder based on current directory |
npmO | npm outdated | Check which npm modules are outdated |
npmV | npm -v | Check package versions |
npmL | npm list | List installed packages |
npmL0 | npm ls --depth=0 | List top-level installed packages |
npmst | npm start | Run npm start |
npmt | npm test | Run npm test |
npmR | npm run | Run npm scripts |
npmP | npm publish | Run npm publish |
npmI | npm init | Run npm init |
| bi | bower install | Installs the project dependencies listed in bower.json |
| bl | bower list | List local packages and possible updates |
| bs | bower search | Finds all packages or a specific package. |
Commands
| Command | Description |
|---|
| tabs | Create a new tab in the current directory (macOS - requires enabling access for assistive devices under System Preferences). |
| take | Create a new directory and change to it, will create intermediate directories as required. |
| x / extract | Extract an archive (supported types: tar.{bz2,gz,xz,lzma}, bz2, rar, gz, tar, tbz2, tgz, zip, Z, 7z). |
| zsh_stats | Get a list of the top 20 commands and how many times they have been run. |
| uninstall_oh_my_zsh | Uninstall Oh-my-zsh. |
| upgrade_oh_my_zsh | Upgrade Oh-my-zsh. |
| source ~/.zshrc | Uptake new changes |
| 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