
正文
登录linux时 shell执行顺序
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
# .bash_history,.bash_logout,.bash_profile,.bashrc
/etc/profile 全局
.bash_history 记录当前登录用户历史操作的命令
.bash_logout 当前用户登出时执行的命令
.bash_profile 交互式登录时执行的内容
.bashrc 非交互式登录执行的内容
举例:
root用户切换到oracle用户
#
1.交互式登录
,shell执行顺序:su - oracle
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
#
2.非交互式登录
,shell执行顺序: su oracle
/etc/bashrc
~/.bashrc
因此当出现类似于下面错误时,应该考虑切换用户登录的方式
lsnrctl status
bash: lsnrctl: command not found






![【电子书】[职业技术] 《Linux命令行与shell脚本编程大全(第3版)》[Richard Blum][epub+mobi+azw3] 【电子书】[职业技术] 《Linux命令行与shell脚本编程大全(第3版)》[Richard Blum][epub+mobi+azw3]](https://www.04ip.com/template/qe/style/noimg/14.jpg)

