Ubuntu安装zsh,oh-my-zsh

查看系统当前使用的shell

echo $SHELL

查看系统安装的所有shell

cat /etc/shells

安装zsh

apt-get install zsh

设置默认shell为zsh

chsh -s $(which zsh)

重启系统,可使用

reboot

完成后可以使用下面这条命令检查是否设置成功

echo $SHELL

我们可以在命令行中输入这个命令来查看我们的电脑上是否安装了zsh命令行

zsh --version

如果安装了,这个命令就会输出zsh当前的版本号。确定 zsh 已经安装后,我们就可以继续安装Oh My Zsh了。

安装Oh My Zsh
wget 方式

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

安装过程中输出如下

Cloning Oh My Zsh...
Cloning into '/root/.oh-my-zsh'...
remote: Counting objects: 712, done.
remote: Compressing objects: 100% (584/584), done.
remote: Total 712 (delta 15), reused 522 (delta 4), pack-reused 0
Receiving objects: 100% (712/712), 443.58 KiB | 27.00 KiB/s, done.
Resolving deltas: 100% (15/15), done.
Checking connectivity... done.
Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc
Copying your current PATH and adding it to the end of ~/.zshrc for you.
Time to change your default shell to zsh!
        __                                     __
 ____  / /_     ____ ___  __  __   ____  _____/ /_
/ __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/
                       /____/                       ....is now installed!
 
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us at https://twitter.com/ohmyzsh.
p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.

到这里,Oh My Zsh 就安装成功了。
Oh My Zsh目录结构
进入~/.oh-my-zsh目录后,看看该目录的结构

ls ~/.oh-my-zsh

cache  custom  lib  log  MIT-LICENSE.txt  oh-my-zsh.sh  plugins  README.markdown  templates  themes  tools

lib 提供了核心功能的脚本库
tools 提供安装、升级等功能的快捷工具
plugins 自带插件的存在放位置
templates 自带模板的存在放位置
themes  自带主题文件的存在放位置
custom 个性化配置目录,自安装的插件和主题可放这里

配置主题,进入配置文件

vim  ~/.zshrc
ZSH_THEME="lambda"	# 选择主题
ZSH_THEME="random"	# 随机自动选择主题
echo $ZSH_THEME		# 查看当前主题

查看主题文件及使用vim可以修改主题的样式

~/.oh-my-zsh/themes

[oh-my-zsh]异常提示

[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxrwx  7   admin  224  4 24 10:51 /usr/local/share/zsh

[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh]     compaudit | xargs chmod g-w,o-w

[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

解决方法

vim .zshrc
==在顶部加入==
ZSH_DISABLE_COMPFIX=true
执行生效命令
source .zshrc

参考文章:https://blog.csdn.net/amoscykl/article/details/80616873
参考文章:https://blog.csdn.net/czg13548930186/article/details/72858289
参考文章:https://blog.csdn.net/qierkang/article/details/85941316
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Tian丶Yuting

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值