zsh安装及配置

zsh安装及配置Ifyoucomefro PATH exportPATH HOME bin usr local bin PATH Pathtoyouroh my zshinstallat exportZSH home amoscykl oh my zsh Setnameofthe Optionally ifyousetthis

安装

sudo apt-get install zsh

centos的话

sudo yum install -y zsh

然后就是下载oh my zsh

①把 oh-my-zsh 项目 Clone 下来:

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

github不行的话去gitee

git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh

②复制 .zshrc

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

③更改你的默认 Shell

chsh -s /bin/zsh

当这种操作不成功的时候,那就是当前用户没有在/etc/passwd 里,

(2条消息) linux(ubuntu)没有在/etc/passwd里的用户如何修改默认 shell(zsh)_hxxjxw的博客-CSDN博客

OK! 完成!

终极 Shell——ZSH – 知乎

zsh & oh-my-zsh 的配置与使用 – 知乎

迁移环境变量的话,只需要把.bashrc中的export和path复制到.zshrc就行了

配置

插件可以装很多,但是装多了之后会在每次进入命令提示符的时候明显变慢。慎用。

更改了配置source的话

source ~/.zshrc

zsh-autosuggestions, zsh-syntax-highlighting都需要自己下

#autosuggestions git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions #syn-highlight git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting 

gitee上

git clone https://gitee.com/pocmon/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions git clone https://gitee.com/jklash1996/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting git clone https://gitee.com/null_454_5218/autojump.git $ZSH_CUSTOM/plugins/autojump

配置autojump

#autojump git clone https://github.com/joelthelion/autojump.git $ZSH_CUSTOM/plugins/autojump #.到目录autojump中 cd $ZSH_CUSTOM/plugins/autojump #执行install.py ./install.py 
vi ~/.zshrc #在配置结尾处或者参考上面处添加此行命令 plugins=( git zsh-autosuggestions autojump ) 根据执行的install.py的提示,把这句添加到.zshrc的最后(不同版本的这句话可能稍有差别) [[ -s /home/v-xixuanhao/.autojump/etc/profile.d/autojump.sh ]] && source /home/v-xixuanhao/.autojump/etc/profile.d/autojump.sh 

设置alias

alias img_num='ls -l ./|grep "^-"|wc -l' alias tmuxt='tmux attach -t'

84的配置

# If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="/home/xxhao/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes #ZSH_THEME="robbyrussellsellsell" #ZSH_THEME="ys" ZSH_THEME="steeef" #ZSH_THEME="agnoster" # Set list of themes to pick from when loading at random # Setting this variable when ZSH_THEME=random will cause zsh to load # a theme from this variable instead of looking in $ZSH/themes/ # If set to an empty array, this variable will have no effect. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" # Uncomment one of the following lines to change the auto-update behavior # zstyle ':omz:update' mode disabled # disable automatic updates # zstyle ':omz:update' mode auto # update automatically without asking # zstyle ':omz:update' mode reminder # just remind me to update when it's time # Uncomment the following line to change how often to auto-update (in days). # zstyle ':omz:update' frequency 13 # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS="true" # 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. # You can also set it to another string to have that shown instead of the default red dots. # e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" # Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) # 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. # You can set one of the optional three formats: # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # or set a custom format using the strftime function format specifications, # see 'man strftime' for details. # 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? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git zsh-autosuggestions zsh-syntax-highlighting ) source $ZSH/oh-my-zsh.sh # User configuration # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment #export LC_ALL=en_US.UTF-8 #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" # 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" # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/xxhao/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/home/xxhao/anaconda3/etc/profile.d/conda.sh" ]; then . "/home/xxhao/anaconda3/etc/profile.d/conda.sh" else export PATH="/home/xxhao/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<< export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64 export PATH=$PATH:/usr/local/cuda-10.0/bin export CUDA_HOME=/usr/local/cuda-10.0 

这里的$PATH的意思是,如果PATH不为空,则指的是PATH原来的内容;如果PATH为空,则指的就是空内容。

即PATH=$PATH:/usr/local/cuda-10.0/bin,就是把/usr/local/cuda-10.0/bin加载PATH的内容后面

PATH=/usr/local/cuda-10.0/bin:$PATH, 就是把/usr/local/cuda-10.0/bin加载PATH内容的最前面

$LD_LIBRARY_PATH同理

所以,目前比较倾向于这个版本了

export CUDA_HOME=/usr/local/cuda-10.2 export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH export PATH=/usr/local/cuda-10.2/bin:$PATH 

上面那个写法,把你要添加的路径放到最后,自己用这台服务器可能没什么,如果想多个cuda版本,或者多个用户不同cuda版本(不影响其他用户的情况下切换cuda版本)那就要用这种写法

cluster的配置

# If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes #ZSH_THEME="robbyrussell" ZSH_THEME="steeef" # Set list of themes to pick from when loading at random # Setting this variable when ZSH_THEME=random will cause zsh to load # a theme from this variable instead of looking in $ZSH/themes/ # If set to an empty array, this variable will have no effect. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" # Uncomment one of the following lines to change the auto-update behavior # zstyle ':omz:update' mode disabled # disable automatic updates # zstyle ':omz:update' mode auto # update automatically without asking # zstyle ':omz:update' mode reminder # just remind me to update when it's time # Uncomment the following line to change how often to auto-update (in days). # zstyle ':omz:update' frequency 13 # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS="true" # 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. # You can also set it to another string to have that shown instead of the default red dots. # e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" # Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) # 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. # You can set one of the optional three formats: # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # or set a custom format using the strftime function format specifications, # see 'man strftime' for details. # 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? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git zsh-autosuggestions zsh-syntax-highlighting ) source $ZSH/oh-my-zsh.sh # User configuration # 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" # 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" # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/root/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then . "/root/anaconda3/etc/profile.d/conda.sh" else export PATH="/root/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<< export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/230124.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月16日 下午3:04
下一篇 2026年3月16日 下午3:05


相关推荐

  • Python set集合 – Python零基础入门教程

    Python set集合 – Python零基础入门教程目录一.set集合简介二.set集合常用函数三.set集合运算符四.猜你喜欢零基础Python学习路线推荐: Python学习目录 >>&#16

    2022年7月5日
    23
  • DHCP option82_dhcp中继配置命令

    DHCP option82_dhcp中继配置命令option82是dhcp报文中的中继代理信息选项(relayagentinformationoption)。当dhcpclient发送请求报文到dhcpserver时,若需要经过dhcp中继,则由dhcp中继将option82添加到请求报文中。option82包含很多sub-option,本文中的option82只支持sub-option1、sub-option2和sub-

    2022年8月31日
    9
  • gamma校正什么意思_串联滞后校正对系统性能的影响

    gamma校正什么意思_串联滞后校正对系统性能的影响【Gamma的由来】首先,要区分照度和亮度,照度是一个客观的量,亮度是一个主观的量,不同的人看相同照度的物体所感受到的亮度是不一样的。对于照度线性变化的物体,人眼感受到的亮度不是线性的。人眼对于低照度的物体更敏感,这意味着对于照度为2、3、4的三个物体,人眼能够区分,而对于照度为222、223、224的三个物体,人眼不能区分。其次,我们存储颜色的空间是有限的,常用的RGBA32格式,每个颜色通道只有8位,最多能表示256种照度,而现实世界中的照度远超256。基于人眼对照度的感知特点,我们不能线性的去

    2026年2月15日
    4
  • git删除本地分支和远程分支_git删除远程分支

    git删除本地分支和远程分支_git删除远程分支git上面的分支开发完成以后,完成了他的历史使命,就可以删除了。1.删除本地分支查看本地分支gitbranchadd_jvm_config_and_exception_loghdfs_config_in_zk*mastersubBucket删除已经merge的本地分支gitbranch-dadd_jvm_config_and_exception_log…

    2022年10月9日
    5
  • java卸载干净_win10系统java如何卸载_win10怎么把java卸载干净

    java卸载干净_win10系统java如何卸载_win10怎么把java卸载干净win10系统功能强大,在使用win10系统电脑过程中,经常需要对系统中一些不需要的java程序进行卸载,对于一些不熟悉win10系统电脑操作的用户来说,完全不知道win10系统java程序如何卸载,那么下面就由小编来给大家介绍一下win10系统java卸载详细教程。具体方法:方法一:1、单击开始菜单,选择【设置】按钮;2、打开设置会弹出windows设置,在弹出的窗口点击【应用】按钮;3、在右…

    2022年5月12日
    69
  • 【转载】C# sleep 和wait的区别

    【转载】C# sleep 和wait的区别

    2021年11月20日
    53

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号