Configuration files that may need to be modified during Linux installation: /etc/profile, /etc/bashrc (ubuntu does not have this file, correspondingly, it has /etc/bash.bashrc file. I use the ubuntu system, so the following will be used /etc/bash.bashrc), ~/.bash_profile, ~/.bash_login, ~/.profile, ~/.bashrc.
By default, the utuntu system only has four files: /etc/ profile, /etc/bash.bahsrc, ~/.profile, and ~/.bashrc. Other files can be created.
1 /etc/profile
Used to set system-wide environment variables and startup programs
2 ~/.profile
This file is a user-level setting. This file can also be used to configure environment variables and start programs, but only for a single user.
3 ~/.bashrc and /etc/bashrc (/etc/bash.bahsrc)
These two files are used to configure functions or aliases. /etc/bashrc is system-level, and ~/.bashrc is user-level. The two will take effect for all users and the current user respectively.
Reading order:
Add echo statement tests to 4 files
switch administrator
eko @ ubuntu: ~ $ su - Password: here is /etc/bash.bashrc here is /etc/profile
switch user
root @ ubuntu: ~ # su - 'eko' here is /etc/bash.bashrc here is /etc/profile here is /eko/.bashrc here is /eko/.profile
It can be seen that the execution sequence of the login shell is:
/etc/.bashrc --> /etc/profile --> ~/.bashrc --> ~/.profile
non-login shell
eko @ ubuntu: ~ $ su Password: here is /etc/bash.bashrc
root @ ubuntu: / home / eko # su 'eko' here is /etc/bash.bashrc here is /eko/.bashrc
/etc/bash.bashrc --> ~/.bashrc