当前位置: 首页 > web >正文

zsh安装及配置

安装

sudo apt-get install zsh

centos的话

sudo yum install -y zsh

非 root 的话,参考

无 root 或 sudo 权限安装 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-autosuggestionsgit clone https://gitee.com/jklash1996/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlightinggit 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=(gitzsh-autosuggestionsautojump
)
根据执行的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'

ZSH_THEME="eastwood"  主题也还行

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=(gitzsh-autosuggestionszsh-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 ]; theneval "$__conda_setup"
elseif [ -f "/home/xxhao/anaconda3/etc/profile.d/conda.sh" ]; then. "/home/xxhao/anaconda3/etc/profile.d/conda.sh"elseexport 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 ]; theneval "$__conda_setup"
elseif [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then. "/root/anaconda3/etc/profile.d/conda.sh"elseexport 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

http://www.xdnf.cn/news/11613.html

相关文章:

  • 科大讯飞副总裁刘鹏:人机交互的未来是人人交互?
  • Python能用来做什么?以下是Python的三大主要用途
  • do...while循环概要
  • 【网络安全】sick0s 靶场实践之getshell
  • postgreSQL 操作 教程
  • Android | 广播( Broadcast )
  • 智慧养老照护:科技赋能,让老年人享受更美好的晚年生活
  • c++ make_pairpair
  • 10个常用的软件测试工具,你不容错过
  • CSS基础知识点
  • 工作流引擎Activiti系列(一)——初识
  • DHCP原理与配置
  • 二十大计算机专业证书,让你从芸芸众生中脱颖而出
  • (附源码)springboot万花筒 毕业设计 345600
  • Ubuntu 13.10安装ICE
  • 计算机专业答题神器,答题神器哪个好用 答题神器对比测评
  • Android开发丰富资源集锦
  • springboot基于web儿童教育网站 毕业设计-附源码111123
  • “WORD上次启动失败,以安全模式启动”的解决方法
  • (转)Three20 是什么
  • 微信公众号文章汇总
  • Docker——JVM 感知容器的 CPU 和 Memory 资源限制
  • 摄影师的专属:OPPO Find X3 Pro摄影师版深度体验
  • 探索黑客工具箱:HackTools,你的安全研究得力助手
  • socket接收汉字乱码问题
  • DDOS 攻击是什么?有哪些常见的DDOS攻击?
  • 服务器防护安全措施有哪些?
  • Remote Administrator 2.1中文版
  • Java的三大特性(基本特征)
  • 班级网页制作 HTML个人网页设计 我的班级网站设计与实现 大学生简单班级静态HTML网页设计作品 DIV布局班级网页模板代码 DW学生校园网站制作成品下载