centos7 linux安装ohmyzsh zsh root和非root 子账号

切换到root

vim /etc/sudoers

安装ohmyzsh前必须安装zsh

yum install zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

如果访问不了 参考下面解决

安装MAVROS出现"raw.githubusercontent.com (raw.githubusercontent.com)|::|:443... 失败:拒绝连接。"问题_城南蜈蚣的博客-CSDN博客 (里面的地址不能用力改成这个 raw.githubusercontent.com域名解析IP地址查询,www.raw.githubusercontent.com 网站服务器所在地信息查询

手动按装2(1有时候半天clone不下来)

浏览器打开 https://github.com/robbyrussell/oh-my-zsh.git 下载zip包 然后复制到 ~/.oh-my-zsh-git 下

进入~/.oh-my-zsh-git/tools文件夹,执行

./install.sh

之后可以删除


安装autojump

git clone git://github.com/joelthelion/autojump.git

cd autojump

./install.py 安装

./uninstall.py 卸载

在 ~/.zshrc 中加入下面 代码

[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

source ~/.zshrc

测试

autojump --version


安装 zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

在 .zshrc中开头添加

ZSH_DISABLE_COMPFIX="true"

然后添加plugins里面的内容

plugins=(zsh-autosuggestions)

重新打开terminal


安装 zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

添加到plugins

plugins=( [plugins...] zsh-syntax-highlighting)

重新打开terminal


安装 zsh-history-substring-search

git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

在 .zshrc中添加 (注意开头没有 zsh-)

plugins=(history-substring-search)

重新打开terminal


直接添加 vi-mode

plugins=(vi-mode)


给子账户也加上zsh

以root身份 cp

cp -r .oh-my-zsh /home/bob

cp -r .autojump /home/bob

chown -R bob:bob /home/bob/.autojump

chown -R bob:bob /home/bob/.oh-my-zsh

切到子账户bob

cd ~

vim .zshrc

# Path to your oh-my-zsh installation. #export ZSH="/root/.oh-my-zsh" export ZSH="/home/bob/.oh-my-zsh"

vim .bash_profile 末尾加上下面代码

export PATH exec /bin/zsh -l

然后重启一个terminal 登录 即可

theme 改成 mira 可以看到是哪个用户 默认的看不到用户 不怎么好

或者自己去 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 找个自己喜欢的

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值