您的位置:首页 > 运维架构 > Shell

bash登录式shell(完全切换)与非登陆式shell(不完全切换)区别

2016-01-14 14:48 267 查看
1、以登录式shell切换用户

su - username


登录式shell读取配置文件及其顺序:

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


2、以非登陆式shell切换用户

su username


非登陆式shell读取配置文件及其顺序:

~/.bashrc
/etc/bashrc
/etc/profile.d/*.sh


附:bash配置文件

1、全局配置文件

/etc/profile
/etc/profile.d/*.sh
/etc/bashrc


2、用户个人配置文件

~/.bash_profile
~/.bashrc


其中:

profile类配置:设置环境变量,执行登陆后自动运行的命令或脚本

bashrc类配置:设定本地变量,设定别名
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: