(1) profile和bashrc
影响范围 | 加载 | |
/etc/profile | 系统 | 系统登录后 |
~/.profile | 用户 | 启动bash shell |
/etc/bash.bashrc | 系统 | 系统登录后 |
~/.bashrc | 用户 | 启动bash shell |
配置环境变量一般在这两种文件中。先讲讲什么时候执行,后面再介绍这两种文件做了什么。
profile在系统登录后执行,只在登录系统时执行一次,包括针对系统的/etc/profile和针对用户的~/.profile。
bashrc在每次启动bash shell(打开终端或者在终端输入sh)后执行,包括针对系统的/etc/bash.bashrc和针对用户的~/.bashrc(这里注意一下我的ubuntu里是/etc/bash.bashrc,其它系统可能是/etc/bashrc)
cat /etc/profile
cat /etc/bash.bashrc
cat ~/.profile
cat ~/.bashrc
https://www.cnblogs.com/liaohuiqiang/p/7197581.html?utm_source=itdadao&utm_medium=referral