环境:ubuntu 18.04
在/etc/profile中配置了ulimit -c unlimited后,每次打开终端都需要source /etc/profile才可生效,导致core dump无法长期生效
如下几类配置文件
1.bashrc是在系统启动后就会自动运行。
2.profile是在用户登录后才会运行。
3./etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量。
原因分析
1.login shell:需要输入密码登录,例如通过su username 登录。
2.non-login shell:登录不需要密码,例如直接在ubuntu当前用户打开的终端。
non-login模式下,终端不会读取/etc/profile和/.bash_profile,而是读取/.bashrc来应用新的环境变量。
non-login模式下使/etc/profile配置永久生效的解决方法
1.环境变量配置或相关命令直接下载~/.bashrc文件
2.修改/etc/profile后,在~/.bashrc中加入source /etc/profile 即可