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

1、以登录式shell切换用户

su - username

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

1 /etc/profile
2 /etc/profile.d/*.sh
3 ~/.bash_profile
4 ~/.bashrc
5 /etc/bashrc

 

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

su username

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

1 ~/.bashrc
2 /etc/bashrc
3 /etc/profile.d/*.sh

 

附:bash配置文件

1、全局配置文件

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

2、用户个人配置文件

~/.bash_profile
~/.bashrc

其中:

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

bashrc类配置:设定本地变量,设定别名

 

转载于:https://www.cnblogs.com/imzye/p/5130199.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值