CentOS7安装oh-my-zsh(github start Top 10)

简介: CentOS7安装oh-my-zsh(github start Top 10)

1、github上的Top 10 star

2、安装

curl or wget and git 应该先安装

其实这是将两步合并为一步了,也可以这样

1、wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh

2、sh install.sh

如果报错,大多是zsh没安装

yum -y install zsh

915fe611e87c4d1d92ec4c48fc72e15b.png此时再重新执行安装命令。

3、效果dfeb43dc59d245c7b3ee14ef4765b8f5.png4、如何切换bash

zsh其实就是一个bash的一种 ,是在bash的基础上做了视觉上的优化。总之大多数人就是喜欢这种花花绿绿的,整体面对黑框框容易视觉疲劳。

当然你厌倦了zsh,可以随时切换bash。

直接bash zsh就好了。这些环境变量都加载好着。如果你执行切不过去。

可以这样:

5、修改主题

zsh最大的魅力就在于可以增加很多主题,例如

查看主题

 ⚡ root@ninesun  ~  ls ~/.oh-my-zsh/themes
3den.zsh-theme           cypher.zsh-theme      frisk.zsh-theme            jonathan.zsh-theme        mikeh.zsh-theme                 refined.zsh-theme       suvash.zsh-theme
adben.zsh-theme          dallas.zsh-theme      frontcube.zsh-theme        josh.zsh-theme            miloshadzic.zsh-theme           rgm.zsh-theme           takashiyoshida.zsh-theme
af-magic.zsh-theme       darkblood.zsh-theme   funky.zsh-theme            jreese.zsh-theme          minimal.zsh-theme               risto.zsh-theme         terminalparty.zsh-theme
afowler.zsh-theme        daveverwer.zsh-theme  fwalch.zsh-theme           jtriley.zsh-theme         mira.zsh-theme                  rixius.zsh-theme        theunraveler.zsh-theme
agnoster.zsh-theme       dieter.zsh-theme      gallifrey.zsh-theme        juanghurtado.zsh-theme    mlh.zsh-theme                   rkj-repos.zsh-theme     tjkirch_mod.zsh-theme
alanpeabody.zsh-theme    dogenpunk.zsh-theme   gallois.zsh-theme          junkfood.zsh-theme        mortalscumbag.zsh-theme         rkj.zsh-theme           tjkirch.zsh-theme
amuse.zsh-theme          dpoggi.zsh-theme      garyblessington.zsh-theme  kafeitu.zsh-theme         mrtazz.zsh-theme                robbyrussell.zsh-theme  tonotdo.zsh-theme
apple.zsh-theme          dstufft.zsh-theme     gentoo.zsh-theme           kardan.zsh-theme          murilasso.zsh-theme             sammy.zsh-theme         trapd00r.zsh-theme
arrow.zsh-theme          dst.zsh-theme         geoffgarside.zsh-theme     kennethreitz.zsh-theme    muse.zsh-theme                  simonoff.zsh-theme      wedisagree.zsh-theme
aussiegeek.zsh-theme     duellj.zsh-theme      gianu.zsh-theme            kiwi.zsh-theme            nanotech.zsh-theme              simple.zsh-theme        wezm+.zsh-theme
avit.zsh-theme           eastwood.zsh-theme    gnzh.zsh-theme             kolo.zsh-theme            nebirhos.zsh-theme              skaro.zsh-theme         wezm.zsh-theme
awesomepanda.zsh-theme   edvardm.zsh-theme     gozilla.zsh-theme          kphoen.zsh-theme          nicoulaj.zsh-theme              smt.zsh-theme           wuffers.zsh-theme
bira.zsh-theme           emotty.zsh-theme      half-life.zsh-theme        lambda.zsh-theme          norm.zsh-theme                  Soliah.zsh-theme        xiong-chiamiov-plus.zsh-theme
blinks.zsh-theme         essembeh.zsh-theme    humza.zsh-theme            linuxonly.zsh-theme       obraun.zsh-theme                sonicradish.zsh-theme   xiong-chiamiov.zsh-theme
bureau.zsh-theme         evan.zsh-theme        imajes.zsh-theme           lukerandall.zsh-theme     peepcode.zsh-theme              sorin.zsh-theme         ys.zsh-theme
candy-kingdom.zsh-theme  fino-time.zsh-theme   intheloop.zsh-theme        macovsky-ruby.zsh-theme   philips.zsh-theme               sporty_256.zsh-theme    zhann.zsh-theme
candy.zsh-theme          fino.zsh-theme        itchy.zsh-theme            macovsky.zsh-theme        pmcgee.zsh-theme                steeef.zsh-theme
clean.zsh-theme          fishy.zsh-theme       jaischeema.zsh-theme       maran.zsh-theme           pygmalion-virtualenv.zsh-theme  strug.zsh-theme
cloud.zsh-theme          flazz.zsh-theme       jbergantine.zsh-theme      mgutz.zsh-theme           pygmalion.zsh-theme             sunaku.zsh-theme
crcandy.zsh-theme        fletcherm.zsh-theme   jispwoso.zsh-theme         mh.zsh-theme              random.zsh-theme                sunrise.zsh-theme
crunch.zsh-theme         fox.zsh-theme         jnrowe.zsh-theme           michelebologna.zsh-theme  re5et.zsh-theme                 superjarin.zsh-theme
 ⚡ root@ninesun  ~ 

修改主题

 ⚡ root@ninesun  ~  vim .zshrc
#修改这里切换主题
ZSH_THEME="agnoster"
# agnoster 主题设置:只显示当前用户名
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}

91506ab42e6540dfa9ab78957ea83d21.png

6、增加插件

这里推荐这个博客。

CentOS7安装zsh和oh-my-zsh - StaryJie - 博客园

代码语法高亮显示插件、自动补全插件安装为最后两个最常用的,

其他插件自己慢慢体会,相信你会爱上zsh的。

# 1.进入oh-my-zsh自定义插件目录
cd ~/.oh-my-zsh/custom/plugins
# 2.拉取zsh-autosuggestions代码
git clone https://github.com/zsh-users/zsh-autosuggestions
# 3.在配置文件~/.zshrc中添加插件(注意:自定义安装的插件最好放在所有插件的最下方)
plugins=(
    git
    wd
    colored-man-pages
    yum
    bundler
    rand-quote
    extract
    themes
    gitignore
    zsh_reload
    per-directory-history
    zsh-syntax-highlighting
    zsh-autosuggestions
)
# 4.保存退出之后,source ~/.zshrc即可生效
source ~/.zshrc

7、离线安装手册

  • 下载zsh

找一台有外网的机器准备zsh并上传到repo仓库

curl -O 10.50.10.25/pigsty/zsh-5.0.2-34.el7_8.2.x86_64.rpm
yum -y install /tmp/zsh-5.0.2-34.el7_8.2.x86_64.rpm
  • git clone oh-my-zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
#上传到repo仓库
cd /root && curl 10.50.10.25/pigsty/zsh.tar.gz -o /root/zsh.tar.gz && tar -zxvf zsh.tar.gz
  • 配置 ~/.zshrc
# 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="agnoster"
# agnoster 主题设置:只显示当前用户名
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}
# 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)
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"
 plugins=(
    git
    wd
    colored-man-pages
    yum
    bundler
    rand-quote
    extract
    themes
    gitignore
    zsh_reload
    per-directory-history
    zsh-syntax-highlighting
    zsh-autosuggestions
)
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  • chsh -s /bin/zsh 切换默认shell为zsh
 ~]# chsh -s /bin/zsh
Changing shell for root.
Shell changed.

再次进入就直接是zsh了

参考: oh-my-zsh让终端好用到飞起~ - 掘金

目录
相关文章
|
9月前
|
存储 Ubuntu Linux
VMware-安装CentOS系统教程及安装包
虚拟机相当于是一个独立于你电脑的环境,在这个环境上面,你可以安装Linux、Windows、Ubuntu等各个类型各个版本的系统,在这个系统里面你不用担心有病读等,不用担心文件误删导致系统崩溃。 虚拟机也和正常的电脑系统是一样的,也可以开关机,不用的时候,你关机就可以了,也不会占用你的系统资源,使用起来还是比较方便 这里也有已经做好的CentOS 7系统,下载下来解压后直接用VMware打开就可以使用
1480 69
|
8月前
|
存储 分布式计算 Linux
安装篇--CentOS 7 虚拟机安装
VMware 装 CentOS 7 不知道从哪下手?这篇超详细图文教程手把手教你在 VMware Workstation 中完成 CentOS 7 桌面系统的完整安装流程。从 ISO 镜像下载、虚拟机配置,到安装图形界面、设置用户密码,每一步都有截图讲解,适合零基础新手快速上手。装好之后无论你是要搭 Hadoop 集群,还是练 Linux ,这个环境都够你折腾一整天!
3413 3
|
9月前
|
Ubuntu Linux 索引
Centos 7、Debian及Ubuntu系统中安装和验证tree命令的指南。
通过上述步骤,我们可以在CentOS 7、Debian和Ubuntu系统中安装并验证 `tree`命令。在命令行界面中执行安装命令,然后通过版本检查确认安装成功。这保证了在多个平台上 `tree`命令的一致性和可用性,使得用户无论在哪种Linux发行版上都能使用此工具浏览目录结构。
787 78
|
10月前
|
Linux 网络安全 Apache
针对在Centos/Linux安装Apache过程中出现的常见问题集锦
以上每个问题的解决方案应深入分析错误日志、系统消息和各种配置文件,以找到根本原因并加以解决。务必保持系统和Apache软件包更新到最新版本,以修复已知的bugs和安全漏洞。安装和管理Web服务器是一项需要细致关注和不断学习的任务。随着技术的发展,推荐定期查看官方文档和社区论坛,以保持知识的更新。
378 80
|
8月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
2002 16
|
9月前
|
存储 关系型数据库 MySQL
在CentOS 8.x上安装Percona Xtrabackup工具备份MySQL数据步骤。
以上就是在CentOS8.x上通过Perconaxtabbackup工具对Mysql进行高效率、高可靠性、无锁定影响地实现在线快速全量及增加式数据库资料保存与恢复流程。通过以上流程可以有效地将Mysql相关资料按需求完成定期或不定期地保存与灾难恢复需求。
682 10
|
10月前
|
人工智能 数据挖掘 Linux
Centos安装Python3.7(亲测可用)
本指南详细介绍了在基于Linux(以CentOS系统为例,使用yum包管理器)的系统上安装Python 3.7版本的完整流程。Python是一种广泛使用的高级编程语言,在各种领域如软件开发、数据分析、人工智能和区块链开发等都有着重要的应用。
827 2
|
9月前
|
运维 网络协议 Linux
CentOS下Bind服务的安装与故障排查
通过以上的步骤,您应该能够在CentOS系统上安装并配置BIND DNS服务,并进行基本的故障排查。
716 0
|
9月前
|
存储 Ubuntu Linux
安卓手机免root安装各种Linux系统:Ubuntu, Centos,Kali等
此外还可以安装Slackware、Archstrike等系统,还可以通过github查找方法安装更多有趣的东西。 昨日小编就是通过Termux安装的Kali Linux工具包。