有哪些程序网站,做网站时量宽度的尺子工具,北京简网世纪科技有限公司,营销软件网站上篇文章讲解了 profile 文件的作用、login shell 和 non-login shell 的定义、不同 profile 被 bash shell 在不同情况下的加载顺序和作用#xff0c;本文讲解一下 zsh shell 相关的知识。
zsh shell MacOS 从 Catalina 版本开始将 zsh 作为默认登录 shell 和交互式 shell。…上篇文章讲解了 profile 文件的作用、login shell 和 non-login shell 的定义、不同 profile 被 bash shell 在不同情况下的加载顺序和作用本文讲解一下 zsh shell 相关的知识。
zsh shell MacOS 从 Catalina 版本开始将 zsh 作为默认登录 shell 和交互式 shell。
zsh 的配置文件加载顺序大致如下
/etc/zshenv这是zsh启动时的第一个配置文件全局生效对所有用户都有效。~/.zshenv这是针对每个用户的第一个配置文件对单个用户有效。/etc/zsh/zshrc这是zsh的默认配置文件对所有用户有效。~/.zshrc这是每个用户的默认配置文件对单个用户有效。~/.zprofile、~/.zsh、~/.zlogin、~/.zlogout这些文件是针对每个用户的登录和退出脚本对单个用户有效。
zsh shell 是不会执行 /etc/profile 和 ~/.bash_profile 文件的当从 bash 切换为 zsh 时如果不想再配置一遍 ~/.zshrc 文件可以在 ~/.zshrc 文件中加上 source ~/.bash_profile以直接从 ~/.bash_profile 文件读取配置。
如何查看当前使用的 shell
可以使用如下命令来查看当前使用的 shell
echo $SHELL
在我电脑上运行效果如下
$ echo $SHELL
/bin/zsh
可以使用如下命令查看系统中安装了哪些 shell
cat /etc/shells
在我电脑上运行效果如下
cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells./bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh