/Etc/profile: This file sets the environment information for each user in the system. When the user logs on for the first time, this file is executed.
And collect shell settings from the configuration file in the/etc/profile. d directory.
/Etc/bashrc: execute this file for every user running bash shell. When bash shell is opened, the file is read.
~ /. Bash_profile: each user can use this file to enter the shell information dedicated to his/her use. When a user logs on,
The file is executed only once! By default, it sets some environment variables to execute the user's. bashrc file.
~ /. Bashrc: This file contains bash information dedicated to your bash shell. When you log on and every time you open a new shell,
The file is read.
~ /. Bash_logout: execute this file every time you exit the system (exit bash shell.
In addition, the variables (global) set in/etc/profile can act on any user ~ The variables (local) set in/. bashrc can only inherit the variables in/etc/profile. They are "Parent-Child" relationships.
~ /. Bash_profile is interactive and login to run in bash.
~ /. Bashrc runs in bash in interactive non-login mode.
Generally, the two settings are roughly the same, so the former usually calls the latter.
Set to take effect: You can restart to take effect, or use the command: Source
Alias PHP =/var/eyouim/pub/PHP/bin/PHP
Source/etc/profile
2.3. User Environment Configuration
To make Bash better serve us, we need to customize the bash shell environment.
2.3.1. bash_profile,. bashrc, And. bash_logout
The above three files are the user environment configuration file of BASH Shell, which is located in the user's main directory. Among them,. bash_profile is the most important configuration file. It is read every time a user logs on to the system, and all the commands in it will be executed by bash .. Profile (used by the Bourne shell and the Korn shell) and. login (used by the C shell) files are synonyms of. bash_profile to ensure compatibility with other shells. Use the. profile file In Debian to replace the. bash_profile file.
The. bashrc file will be read when the bash shell calls another bash shell, that is, when you type the bash command in the shell to start a new shell, it will read the file. This effectively isolates the environment required for logon and sub-shell. Generally, the. bashrc script is called in. bash_profile to configure the user environment in a unified manner.
. Bash_logout is read when you exit shell. So we can put some cleanup commands in this file.
Bash. bashrc and profile are system-level (global) configuration files that cannot be found in the user's main directory. bash_profile and. bashrc \ will read the two files .. Bash_history is a history file of the bash shell, which records all the commands you input in the bash shell. You can use the hissize environment variable to set the number of records saved in the history file. Alias L = 'LS-L' is the statement used to set the alias. Put it in these configuration documents so that we can use the simple 'l' command, replace the 'LS-l' command.
After these configuration items are modified, use the source. bash_profile command to make the changes take effect immediately. 2.3.2. Options
The options in bash shell can control shell behaviors and functions. We can set them using the shopt command. The SET command can also be used, but it has been replaced by shopt. However, the set command can still be used to perform down synchronization. The shopt command without parameters can be used to list the options in the current shell that can only be set by shopt. shopt-O can be used to list the options that can be set by the set command.
The following are some basic options that can be used by the set command, which are disabled by default.
Emacs enters the Emacs editing mode.
VI enters VI editing mode
Ignoreeof does not allow the use of ctrl_d to exit. Use Exit. Equivalent to ignoreeof = 10
Noclobber does not allow redirection to overwrite existing files
Noglob does not allow wildcard extension of file names
An error is returned when nounset uses undefined variables.
The following are some options that can only be set by the shopt command.
Cdspell automatically corrects small errors in the CD Command Parameters
When hostcomplete starts with @, press the tab key to automatically complete the Host Name
Dotgblob file names starting with dots are included in the pathname extension.
Mailwarn displays mail warning information
The shopt command has the following options:
-P: Display configurable options and current values
-S: set each option to on
-U: set each option to off.
-Q: No output information
-O