Zsh是一個Linux用戶不多使用的shell,這是因爲大多數Linux產品安裝,以及默認使用bash shell。幾乎每一款Linux產品都包含有zsh,一般能夠用apt-get、urpmi或yum等包管理器進行安裝。詳見百度百科.git
但因爲Zsh的配置過於複雜,有程序員開發了Oh My Zsh的開源項目,自此,只須要簡單的安裝配置,小白程序員們均可以用上高檔大氣上檔次,狂拽炫酷吊炸天的
oh my zsh
程序員
先安裝zshgithub
sudo apt-get install zsh sudo: 沒法解析主機:c80k2-Vostro-3667 [sudo] c80k2 的密碼: 正在讀取軟件包列表... 完成 正在分析軟件包的依賴關係樹 正在讀取狀態信息... 完成 將會同時安裝下列軟件: zsh-common 建議安裝: zsh-doc 下列【新】軟件包將被安裝: zsh zsh-common 升級了 0 個軟件包,新安裝了 2 個軟件包,要卸載 0 個軟件包,有 388 個軟件包未被升級。 須要下載 3,834 kB 的歸檔。 解壓縮後會消耗 14.2 MB 的額外空間。 您但願繼續執行嗎? [Y/n] Y 獲取:1 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 zsh-common all 5.1.1-1ubuntu2.3 [3,182 kB] 獲取:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 zsh amd64 5.1.1-1ubuntu2.3 [652 kB] 已下載 3,834 kB,耗時 2秒 (1,332 kB/s) 正在選中未選擇的軟件包 zsh-common。 (正在讀取數據庫 ... 系統當前共安裝有 411712 個文件和目錄。) 正準備解包 .../zsh-common_5.1.1-1ubuntu2.3_all.deb ... 正在解包 zsh-common (5.1.1-1ubuntu2.3) ... 正在選中未選擇的軟件包 zsh。 正準備解包 .../zsh_5.1.1-1ubuntu2.3_amd64.deb ... 正在解包 zsh (5.1.1-1ubuntu2.3) ... 正在處理用於 man-db (2.7.5-1) 的觸發器 ... 正在設置 zsh-common (5.1.1-1ubuntu2.3) ... 正在設置 zsh (5.1.1-1ubuntu2.3) ... update-alternatives: 使用 /bin/zsh5 來在自動模式中提供 /bin/zsh (zsh) update-alternatives: 使用 /bin/zsh5 來在自動模式中提供 /bin/rzsh (rzsh)
再安裝oh my zshweb
wget 方式: sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 或者 curl 方式: sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" --2019-02-28 19:21:42-- https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh 正在解析主機 raw.github.com (raw.github.com)... 151.101.228.133 正在鏈接 raw.github.com (raw.github.com)|151.101.228.133|:443... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 301 Moved Permanently 位置:https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh [跟隨至新的 URL] --2019-02-28 19:21:42-- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh 正在解析主機 raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.228.133 正在鏈接 raw.githubusercontent.com (raw.githubusercontent.com)|151.101.228.133|:443... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度: 3976 (3.9K) [text/plain] 正在保存至: 「STDOUT」 - 100%[================================================================================================================>] 3.88K --.-KB/s in 0s 2019-02-28 19:21:43 (55.4 MB/s) - 已寫入至標準輸出 [3976/3976] Cloning Oh My Zsh... 正克隆到 '/home/c80k2/.oh-my-zsh'... remote: Enumerating objects: 1007, done. remote: Counting objects: 100% (1007/1007), done. remote: Compressing objects: 100% (923/923), done. remote: Total 1007 (delta 24), reused 778 (delta 21), pack-reused 0 接收對象中: 100% (1007/1007), 647.38 KiB | 444.00 KiB/s, 完成. 處理 delta 中: 100% (24/24), 完成. 檢查鏈接... 完成。 Looking for an existing zsh config... Using the Oh My Zsh template file and adding it to ~/.zshrc Time to change your default shell to zsh! 密碼:
直到出現:shell
____ / /_ ____ ___ __ __ ____ _____/ /_ / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ / /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / \____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ /____/ ....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, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh.
這時候,本來是數據庫
c80k2@c80k2-Vostro-3667❯/opt/wwwroot/tob/web/be(20190228)$
這樣的,變成了ubuntu
➜ be git:(20190228)
在此基礎上,再裝一個高亮插件:bash
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting 正克隆到 '/home/c80k2/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'... remote: Enumerating objects: 41, done. remote: Counting objects: 100% (41/41), done. remote: Compressing objects: 100% (31/31), done. remote: Total 5321 (delta 16), reused 22 (delta 10), pack-reused 5280 接收對象中: 100% (5321/5321), 1.10 MiB | 701.00 KiB/s, 完成. 處理 delta 中: 100% (3514/3514), 完成. 檢查鏈接... 完成。
而後激活這個插件,經過在curl
vi ~/.zshrc
這個文件中,將插件名稱放入這個配置項中,
url
plugins=(插件名稱1,插件名稱2) 這裏是 plugins=(git,zsh-syntax-highlighting)
而後source一下,讓改變生效
source ~/.zshrc
就能夠了. 這個時候bash就會帶上插件所擁有的效果.
固然,這些插件不可避免地會佔用資源,畢竟須要套用它的配置,因此會對bash上的操做速度有必定的影響.若是你想卸載,能夠遵守如下步驟.
rm -rf ~/.oh-my-zsh