zsh安装及配置

2023-05-16

安装

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

zsh安装及配置 的相关文章

  • VS中报错IntelliSense: argument of type "void *" is incompatible with parameter of type "const char *"

    在用VS编写C 43 43 程序的时候 xff0c 遇到这样的问题IntelliSense argument of type void is incompatible with parameter of type const char xf
  • VS控制台程序被暂停,回车继续运行

    最近用vs调试程序时 用控制台定时1s打印一次信息 xff0c 调试过程发现偶尔出现控制台停止打印 不管是否开启多线程 xff0c 都会出现该问题 xff0c 而且也怀疑可能是sleep xff08 xff09 延时阻塞导致的问题 后来多次
  • VS如何设置显示代码行数

    设置VS显示代码行数 可以方便调试代码 xff0c 工具 选项 文本编辑器 C C 43 常规 行号勾选上 参考了https jingyan baidu com album af9f5a2d2e193543140a4533 html pic
  • 程序员自我介绍

    转自https www cnblogs com univeryinli p 5838781 html 一个常规的面试 xff0c 寒暄之后面试官提出的第一个问题几乎千篇一律 xff1a 请您简单地做一下自我介绍 有些被面试者都会问 xff1
  • win10磁盘占用率过高解决办法

    最近总觉得系统用起来很卡 xff0c 一看任务管理器发现win10磁盘占用率接近100 xff0c 而且在任务管理器中也关不掉 xff0c 然后百度了一下 xff0c 发现可能是家庭组导致 xff0c 结果还真是 xff0c 下面给出解决方
  • 2020届华为C++软件开发实习面试经验

    前几天去华为实习面试 xff08 虽然笔试0AC xff0c 还是收到面试通知 xff09 xff0c 现在记录一下面试心得 xff0c 后面继续好好准备 实习面试分技术面和综合面 xff1a 1 感觉技术面试重视基础 xff0c 问c 4
  • 自己编写的字符串分割函数mysplit()

    利用strtok 函数封装成的字符串分割函数mysplit sourceStr为源字符串 splitSymbol为分隔符号 strArray为分割后的字符串 xff0c 以vector形式返回 include lt iostream gt
  • OVS Bond lacp源码分析

    近期项目中要使用Ovs bond接口 xff0c Ovs Bond 只有三种模式 xff1a balance tcp xff0c balance slb xff0c active backup 这三种模式的工作方式如下 xff1a 1 ac
  • VNC

    VNC Virtual Network Computing 是 虚拟网络 计算机的缩写 VNC 是一款优秀的 远程控制工具软件 xff0c 由著名的 AT amp T 的欧洲研究实验室开发的 VNC 是在基于 UNIX 和 Linux 操作
  • ubuntu 安装图形界面 tasksel不成功

    1 执行tasksel相关的安装命令一直报错 xff0c 经过改源等操作都不行 sudo tasksel install ubuntu desktop 2 参考下面的博客Ubuntu安装图形界面 xff08 桌面 xff09 yangxin
  • 【ChatGPT】比尔·盖茨最新分享:ChatGPT的发展,不止于此

    作者简介 xff1a 在读博士 xff0c 伪程序媛 xff0c 人工智能领域学习者 xff0c 深耕机器学习 xff0c 交叉学科实践者 xff0c 周更前沿文章解读 xff0c 提供科研小工具 xff0c 分享科研经验 xff0c 欢迎
  • 51单片机(十).避障与循迹小车

    实验简介 使用STC89C53单片机作为主控制器芯片实现了带全向轮的两轮驱动避障以及循线小车 xff0c 感知模块为超声波和红外传感器 本实验分为3个独立的部分 xff1a 1 利用超声波实现小车的避障功能 xff1b 2 利用红外传感器实
  • 一点小小的感悟

    从2017年发表了第一篇CSDN文章 xff0c 到现在已经过去了快五年的时间 五年前的我是一名学生 xff0c 五年后的今天我依旧是一名学生 xff0c 区别是从一名大二学生成为了现在的研二学生 这一路走来 xff0c 经历了很多很多事情
  • Arduino单片机(五).基于OpenWrt模块的无线视频遥控小车设计

    1 功能介绍 本项目所设计的机器人需要实现的功能为 xff1a 操作员在操作终端 xff08 手机或PC端 xff09 通过Wi Fi连接到小车上Wi Fi模块所在的网络中 xff0c 向其发出相关操作指令 xff0c 在Wi Fi模块接收
  • STM32单片机(二).STM32系列单片机的介绍

    STM32系列芯片是为要求高性能 低成本 低功耗的嵌入式应用设计的ARM Cortex M0 M0 43 M3 M4和M7内核 xff0c 按照内核架构分成不同的产品 其主流的产品有STM32F0 STM32F1和STM32F3 xff1b
  • STM32单片机(六). 传感器的使用

    传感器是单片机外围电路中最常见的模块 xff0c 在搭配了各种形式的传感器电路后 xff0c 就可以采集到的更多的环境信息 在本章节中 xff0c 主要介绍呼吸灯 温度传感器 RTC实时时钟以及红外遥控模块的控制使用 1 PWM实现呼吸灯的
  • STM32单片机(七). USART串口、IIC和CAN通信

    在简单的学习过了STM32中的简单外设以及中断系统后 xff0c 在本章节中开始介绍STM32芯片中各个通信接口的配置 在计算机中 xff0c 按数据传输方式可分为串行通信以及并行通信 xff1b 按数据同步方式可分为异步通信和同步通信 x
  • STM32单片机(八). ADC、DAC和DMA数据传输

    对于STM32的ADC模数转换器的介绍以及配置在文章 STM32单片机 xff08 六 xff09 传感器的使用 中已经详细介绍 xff0c 在本章节中主要介绍DAC数模转换器以及DMA的使用 1 DAC转换 1 1 数模转换器的介绍 DA
  • 虚拟机中安装Ubuntu 20.04,Liunx系统的常用命令以及工具安装

    因工作学习 需求 xff0c 在虚拟机软件VirtualBox安装了Ubuntu 20 04系统 xff0c 本章节中主要介绍一些环境的安装以及Liunx中常用的一些命令 1 软件和系统的安装 1 1 VirtualBox VirtualB
  • 51单片机(二).STC89C52单片机的引脚功能

    1 主电源引脚VCC和VSS 电源VCC接 43 5V xff0c VSS接地端 xff0c 即公共参考地 2 时钟电路引脚XTAL1和XTAL2 STC89C52芯片内部设置了一个反相放大器 xff0c XTAL1为放大器输入端 xff1

随机推荐