0
点赞
收藏
分享

微信扫一扫

Linux环境变量配置说明

黄昏孤酒 2022-05-03 阅读 59

Linux的环境变量可在多个文件中配置

/etc/profile,/etc/profile.d/*.sh,~/.bashrc,~/.bash_profile等

bash的运行模式可分为login shell和non-login shell。

  • 例如,我们通过终端,输入用户名、密码,登录系统之后,得到就是一个login shell,而当我们执行以下命令ssh hadoop103 command,在hadoop103执行command的就是一个non-login shell。

这两种shell的主要区别在于,它们启动时会加载不同的配置文件

login shell启动时会加载/etc/profile,~/.bash_profile,~/.bashrc
non-login shell启动时会加载~/.bashrc

在这里插入图片描述

验证结论

1.登录式shell
在/etc/profile
在这里插入图片描述
2.非登陆式shell
在/etc/bashrc
在这里插入图片描述

举报

相关推荐

0 条评论