CentOS configuration file

Source: Internet
Author: User
/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 from/etc/profile. the configuration file in the d directory collects shell settings. /etc/bashrc: execute this file for every user running bashshell. when the bashshell is opened, the file is read. ~ /. Bash_profile: each user can use this file to input the shell Information dedicated to their own use.

/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 from/etc/profile. the configuration file in the d directory collects shell settings.

/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 input the shell Information dedicated to their own use. when a user logs on, this file is only executed 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. This file is read when you log on and every time you open a new shell.

~ /. Bash_logout: execute this file every time you exit the system (exit bash shell.

(1) the preceding four files are executed in this order.

(2) the two profile files are executed only when the user logs in, and the two rc files are executed every time bash is opened. Therefore, if you set the environment variable in the profile file, it is invalid in the script, because no user login occurs at this time.

 

The above is the key content. Analyze the work in the five files when you are free.

========================================================== ======================================

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
  1. 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.

  2. 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.

  3. . 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 emacs editing mode vi enters vi editing mode ignoreeof does not allow the use of Ctrl_D alone to exit. use exit. Equivalent to IGNOREEOF = 10 noclobber does not allow redirection to overwrite existing file noglob does not allow extension file name wildcard nounset to use undefined variables.

The following are some options that can only be set by the shopt command.

When the minor error hostcomplete in the cd command parameters 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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.