ubuntu 配置 zsh


之前是记得我同学在我的电脑上帮我配置过炫酷的zsh。这几天在家折腾,突然就想起来这玩意,今天晚上就试试玩


按照这个顺序就可以完成安装!!!


1.先安装zsh和git

   sudo apt-get install zsh git


2.然后把shell切换成zsh,并重启计算机。(注意这个引号,` `  是tab键上面的那个键)

 chsh -s `which zsh`                    
  sudo shutdown -r 0  

重启后重新打开终端会提示选择,此时选择q就可以,下次启动还会提示。当然,我们配置完之后,启动就不会提示了。

按下Q继续操作,直到最后一步(chsh -s /bin/zsh)完成


3.查看当前安装的版本(非必要)

   zsh –verison 

     

4.从GitHub 下载 oh-my-zsh 套件

   git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh 


5.如果从来没有安装过zsh,可以拷贝oh-my-zsh的范例

   cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc 


6.查看有什么theme主题可以使用如下代码

   ls ~/.oh-my-zsh/themes 


7.可以编辑~/.zshrc  文件来修改主题

        sudo gedit ~/.zshrc   

然后修改 

   ZSH_THEME=“candy”    (找到这条语句,然后修改引号内的内容改为candy)

(国外大神对这些主题的截图:https://github.com/robbyrussell/oh-my-zsh/wiki/themes )


8.查看可以使用的plugins

    ls ~/.oh-my-zsh/plugins 



设置zsh替换掉原有的shell

  1. chsh -s /bin/zsh  
chsh -s /bin/zsh



ubuntu中默认安装了那些shell ?

  1. cat /etc/shells  
cat /etc/shells



附: ~/.zshrc 文件默认的内容:

  1. # Path to your oh-my-zsh installation.  
  2. export ZSH=HOME/.oh-my-zsh&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;Set&nbsp;name&nbsp;of&nbsp;the&nbsp;theme&nbsp;to&nbsp;load.&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;Look&nbsp;in&nbsp;~/.oh-my-zsh/themes/&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;Optionally,&nbsp;<span class="keyword">if</span><span>&nbsp;you&nbsp;set&nbsp;</span><span class="keyword">this</span><span>&nbsp;to&nbsp;</span><span class="string">"random"</span><span>,&nbsp;it'll&nbsp;load&nbsp;a&nbsp;random&nbsp;theme&nbsp;each&nbsp;&nbsp;</span></span></li><li class="alt"><span>#&nbsp;time&nbsp;that&nbsp;oh-my-zsh&nbsp;is&nbsp;loaded.&nbsp;&nbsp;</span></li><li class=""><span>ZSH_THEME=<span class="string">"robbyrussell"</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;to&nbsp;use&nbsp;<span class="keyword">case</span><span>-sensitive&nbsp;completion.&nbsp;&nbsp;</span></span></li><li class="alt"><span>#&nbsp;CASE_SENSITIVE=<span class="string">"true"</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;to&nbsp;disable&nbsp;bi-weekly&nbsp;auto-update&nbsp;checks.&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;DISABLE_AUTO_UPDATE=<span class="string">"true"</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;to&nbsp;change&nbsp;how&nbsp;often&nbsp;to&nbsp;auto-update&nbsp;(in&nbsp;days).&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;export&nbsp;UPDATE_ZSH_DAYS=<span class="number">13</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;to&nbsp;disable&nbsp;colors&nbsp;in&nbsp;ls.&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;DISABLE_LS_COLORS=<span class="string">"true"</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;to&nbsp;disable&nbsp;auto-setting&nbsp;terminal&nbsp;title.&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;DISABLE_AUTO_TITLE=<span class="string">"true"</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;to&nbsp;enable&nbsp;command&nbsp;auto-correction.&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;ENABLE_CORRECTION=<span class="string">"true"</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;to&nbsp;display&nbsp;red&nbsp;dots&nbsp;whilst&nbsp;waiting&nbsp;<span class="keyword">for</span><span>&nbsp;completion.&nbsp;&nbsp;</span></span></li><li class="alt"><span>#&nbsp;COMPLETION_WAITING_DOTS=<span class="string">"true"</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;<span class="keyword">if</span><span>&nbsp;you&nbsp;want&nbsp;to&nbsp;disable&nbsp;marking&nbsp;untracked&nbsp;files&nbsp;&nbsp;</span></span></li><li class=""><span>#&nbsp;under&nbsp;VCS&nbsp;as&nbsp;dirty.&nbsp;This&nbsp;makes&nbsp;repository&nbsp;status&nbsp;check&nbsp;<span class="keyword">for</span><span>&nbsp;large&nbsp;repositories&nbsp;&nbsp;</span></span></li><li class="alt"><span>#&nbsp;much,&nbsp;much&nbsp;faster.&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;DISABLE_UNTRACKED_FILES_DIRTY=<span class="string">"true"</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;<span class="keyword">if</span><span>&nbsp;you&nbsp;want&nbsp;to&nbsp;change&nbsp;the&nbsp;command&nbsp;execution&nbsp;time&nbsp;&nbsp;</span></span></li><li class="alt"><span>#&nbsp;stamp&nbsp;shown&nbsp;in&nbsp;the&nbsp;history&nbsp;command&nbsp;output.&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;The&nbsp;optional&nbsp;three&nbsp;formats:&nbsp;<span class="string">"mm/dd/yyyy"</span><span>|</span><span class="string">"dd.mm.yyyy"</span><span>|</span><span class="string">"yyyy-mm-dd"</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>#&nbsp;HIST_STAMPS=<span class="string">"mm/dd/yyyy"</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;Would&nbsp;you&nbsp;like&nbsp;to&nbsp;use&nbsp;another&nbsp;custom&nbsp;folder&nbsp;than&nbsp;ZSH/custom?  
  3. # ZSH_CUSTOM=/path/to/new-custom-folder  
  4.   
  5. # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)  
  6. # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/  
  7. # Example format: plugins=(rails git textmate ruby lighthouse)  
  8. # Add wisely, as too many plugins slow down shell startup.  
  9. plugins=(git)  
  10.   
  11. source ZSH/oh-my-zsh.sh&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>#&nbsp;User&nbsp;configuration&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>export&nbsp;PATH=HOME/bin:/usr/local/bin:PATH&nbsp;&nbsp;</span></li><li class="alt"><span>#&nbsp;export&nbsp;MANPATH=<span class="string">"/usr/local/man:MANPATH”  
  12.   
  13. # You may need to manually set your language environment  
  14. # export LANG=en_US.UTF-8  
  15.   
  16. # Preferred editor for local and remote sessions  
  17. if [[ -n $SSH_CONNECTION ]]; then  
  18. #   export EDITOR=’vim’  
  19. else  
  20. #   export EDITOR=’mvim’  
  21. # fi  
  22.   
  23. # Compilation flags  
  24. # export ARCHFLAGS=”-arch x86_64”  
  25.   
  26. # ssh  
  27. # export SSH_KEY_PATH=”~/.ssh/dsa_id”  
  28.   
  29. # Set personal aliases, overriding those provided by oh-my-zsh libs,  
  30. # plugins, and themes. Aliases can be placed here, though oh-my-zsh  
  31. # users are encouraged to define aliases within the ZSH_CUSTOM folder.  
  32. # For a full list of active aliases, run `alias`.  
  33. #  
  34. # Example aliases  
  35. # alias zshconfig=”mate ~/.zshrc”  
  36. # alias ohmyzsh=”mate ~/.oh-my-zsh”  
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh





Set name of the theme to load.

Look in ~/.oh-my-zsh/themes/

Optionally, if you set this to "random", it'll load a random theme each

time that oh-my-zsh is loaded.

ZSH_THEME="robbyrussell"

Uncomment the following line to use case-sensitive completion.

CASE_SENSITIVE="true"

Uncomment the following line to disable bi-weekly auto-update checks.

DISABLE_AUTO_UPDATE="true"

Uncomment the following line to change how often to auto-update (in days).

export UPDATE_ZSH_DAYS=13

Uncomment the following line to disable colors in ls.

DISABLE_LS_COLORS="true"

Uncomment the following line to disable auto-setting terminal title.

DISABLE_AUTO_TITLE="true"

Uncomment the following line to enable command auto-correction.

ENABLE_CORRECTION="true"

Uncomment the following line to display red dots whilst waiting for completion.

COMPLETION_WAITING_DOTS="true"

Uncomment the following line if you want to disable marking untracked files

under VCS as dirty. This makes repository status check for large repositories

much, much faster.

DISABLE_UNTRACKED_FILES_DIRTY="true"

Uncomment the following line if you want to change the command execution time

stamp shown in the history command output.

The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"

HIST_STAMPS="mm/dd/yyyy"

Would you like to use another custom folder than $ZSH/custom?

ZSH_CUSTOM=/path/to/new-custom-folder

Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)

Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/

Example format: plugins=(rails git textmate ruby lighthouse)

Add wisely, as too many plugins slow down shell startup.

plugins=(git)

source $ZSH/oh-my-zsh.sh

User configuration

export PATH= HOME/bin:/usr/local/bin: PATH

export MANPATH="/usr/local/man:$MANPATH"

You may need to manually set your language environment

export LANG=en_US.UTF-8

Preferred editor for local and remote sessions

if [[ -n $SSH_CONNECTION ]]; then

export EDITOR='vim'

else

export EDITOR='mvim'

fi

Compilation flags

export ARCHFLAGS="-arch x86_64"

ssh

export SSH_KEY_PATH="~/.ssh/dsa_id"

Set personal aliases, overriding those provided by oh-my-zsh libs,

plugins, and themes. Aliases can be placed here, though oh-my-zsh

users are encouraged to define aliases within the ZSH_CUSTOM folder.

For a full list of active aliases, run alias.

#

Example aliases

alias zshconfig="mate ~/.zshrc"

alias ohmyzsh="mate ~/.oh-my-zsh"


现在的样子:






文章写的有点乱,以后弄明白再重新编辑。


参考:

http://blog.sina.com.cn/s/blog_631d3a630102uxtv.html

http://logicmd.net/2012/11/installing-zsh-on-ubuntu/

https://gist.github.com/logicmd/4015090#file-zshrc




附带一个脚本:

  1. #!/bin/bash  
  2.   
  3. #this script is used for install zshell-zsh  
  4.   
  5. echo ”————begin install zsh———–”  
  6.   
  7. sudo apt-get install zsh git  
  8.   
  9. chsh -s which&nbsp;zsh  
  10.   
  11. echo ”———-“  
  12. zsh –version  
  13. echo ”———-“  
  14.   
  15.   
  16. git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh &nbsp;
  17.   
  18. cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc   
  19.   
  20. chsh -s /bin/zsh  
  21.   
  22. sudo shutdown -r 0  
#!/bin/bash

this script is used for install zshell-zsh

echo "------------begin install zsh-----------"

sudo apt-get install zsh git

chsh -s which zsh

echo "----------"
zsh --version
echo "----------"

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

chsh -s /bin/zsh

sudo shutdown -r 0

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值