The type of shell that stands in terms of user login:
Log-in Shell:
Normal usually a terminal login
Su-username (full switch)
Su-l USERNAME
Non-logon Shell:
Su USERNAME (semi-toggle)
Open Command Window under graphics terminal
Shell scripts that are executed automatically
- Since you have set up certain configurations in the user, some configurations will revert to the default configuration at the beginning if you log in again. Then this time you need to configure Bash to set your own default configuration!!!
Bash configuration file:
Global configuration
/etc/profile,/etc/profile.d/*.sh,/ETC/BASHRC
Personal configuration (only valid for logged-in users)
~/.bash_profile, ~/.BASHRC
File for Profile class:
Setting environment variables
Run a command or script (the information that the user displays as soon as they log on)
Files of the BASHRC class:
Setting Local Variables
Defining command aliases
- In general, if an environment variable is defined in both the global configuration and the personal configuration and is not the same, the configuration that typically has a smaller scope is ultimately valid. So if there are ambiguous configurations in both the global configuration and the personal configuration, then the individual configuration is effective.
How does the login shell read the configuration file?
/etc/profile--/etc/profile.d/*.sh--and ~/.bash_profile--~/.BASHRC--/ETC/BASHRC
How do I configure a file for a non-logon shell?
~/.BASHRC--/ETC/BASRC-/etc/profile.d/*.sh
- Example: How to use alias how to define Cls=clear log out after the effective?
First determine when the BASHRC class (set local variables),
Nano. BASHRC
Add a row alias Cls=clear
- Example: How to display a line of text when landing, such as "Hello welcome! ”?
First determine when the profile class (Run command or script),
Nano. Bash_profile
Add a line echo "Hello Welcome!"
Configuration of Linux Learning Note 9--bash