【linux】 profile和bashrc, ~/.profile ,~/.bashrc

(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

 

 

 

posted on 2022-10-04 01:27  bdy  阅读(8)  评论(0编辑  收藏  举报

导航