Environment Configuration Files

本文介绍Linux系统中用户登录后的环境配置过程,涉及四种关键文件:/etc/profile、/etc/bashrc、~/.bash_profile及~/.bashrc的作用与区别。详细解释了登录Shell与Subshell的不同之处及其各自对应的配置文件。

  Environment Configuration Files  

When a user logs in, an environment is created for that user automatically. This happens based on four different files where some script code can be specified and where variables can be defined for use by one specific user:    
■    /etc/profile:     This is the generic file that is processed by all users upon login.  --全局环境变量,对所有用户都生效  
■    /etc/bashrc:     This file is processed when subshells are started.  --

--全局环境变量,对所有用户都生效,子shell启动时需要用到的配置文件  
■    ~/.bash_profile:     In this file, user-specific login shell variables can be defined.   --用户自己定义的login shell环境变量   
■    ~/.bashrc:     In this user-specific file, subshell variables can be defined.    
As you have seen, in these files a difference is made between a login shell and a subshell. A login shell is the first shell that is opened for a user after the user has logged in. From the login shell, a user may run scripts, which will start a subshell of that login shell. Bash allows for the creation of a different environment in the login shell and in the subshell but to synchronize settings; by default the subshell settings are included when entering a login shell.   --用户自己定义的subshell

~/这个表示在用户自己的目录下。如用户testuser,home目录为testuser,则环境变量配置文件为/home/testuser/.bash_profile

转载于:https://www.cnblogs.com/rusking/p/5586612.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值