Linux - 关于几个重要文件

在使用Linux的过程中,一直搞不清楚/etc/rc.local, /etc/profile, /etc/bashrc 这个文件的用处。现在稍微有点眉目,特此记录一下


关于/etc/profile文件,这里又引入了login shell与no login shell的概念

1、登入shell

/etc/profile 是登入shell启动后运行的第一个启动脚本,它只为登入shell运行

登入shell加载启动脚本的顺序为:/etc/profile → /etc/profile.d → .bash_profile → .bashrc → /etc/bashrc

每个调用的脚本会依次撤销前一个调用脚本中的改变

在退出登入shell时,我们还可以执行某些任务,如创建自动备份、清除临时文件,这些任务放在.bash_logout文件中

2、非登入shell

非登入shell加载启动脚本的顺序.bashrc → /etc/bashrc → /etc/profile.d


关于rc.local:

官方的解释为:rc.local is a file, owned by root.root and should be mode 755. The rc.local file is for initialization of programs after the system has fully booted. This script is run right before login prompts are displayed. You can use the file to run last minute startups, set certain environment variables, etc.

表明:该脚本运行在操作系统启动之后,在登录login shell之前。如果环境变量在/etc/profile中配置的话,那么在启动/etc/rc.local脚本时就会找不到环境变量


等完全搞懂,再行补充

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值