Linux environment variables (pony recommended)

Source: Internet
Author: User

/etc/profile: This file sets the environment information for each user of the system, and the file is executed the first time the user logs on. And collects the shell's settings from the/ETC/PROFILE.D directory's configuration file. /ETC/BASHRC: Executes this file for each user running the bash shell. When the bash shell is opened, the file is read. ~/.bash_profile: Each user can use the file to enter shell information dedicated to their own use, and when the user logs in, the file executes only once! By default, he sets some environment variables to execute the user's. bashrc file. ~/.BASHRC: This file contains bash information dedicated to your bash shell, which is read when you log in and every time you open a new shell. ~/.bash_logout: Executes the file each time it exits the system (exiting the bash shell) .   In addition, variables set in/etc/profile (global) can be applied to any user, while variables set in ~/.BASHRC, etc. (local) can only inherit/etc/ The variables in profile, they are "parent-child" relationships.  ~/.bash_profile is interactive, login way into bash run ~/.BASHRC is the interactive non-login way into bash usually the two settings are roughly the same, So the former will usually call the latter.   Settings to take effect: can be restarted to take effect, you can also use the command: Source alias php=/var/eyouim/pub/php/bin/phpsource/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 profile for the bash shell, which is located in the user's home directory. The. Bash_profile is the most important configuration file that is read every time a user logs on to the system, and all commands inside it are executed by bash. Profile (used by Bourne Shell and Korn shell) and. Login (used by C shell) ) Two files are synonyms of. Bash_profile to be compatible with other shells. Use the. profile file in Debian instead of the. bash_profile file. The  .BASHRC file is read when the bash Shell invokes another bash shell, which is then read when the Bash command is typed in the shell to launch a new shell. This effectively separates the environments required for logins and child shells. But in general, it will be called in. bash_profile. BASHRC scripts for unified configuration of user environments.  .bash_logout is read when exiting the shell. So we can put some clean-up orders into this file.   BASH.BASHRC and profile in the/etc directory are system-level (global) configuration files that are read when the. Bash_profile and. Bashrc\ are not found in the user's home directory. Bash_history is bash The Shell's history file, which recordsAll the commands you entered 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 that sets the alias, and placing it in these configuration documents allows us to replace the ' ls-l ' command with a simple ' l ' command.    when we have modified these configurations, you can use the source. Bash_profile command to make its modifications effective immediately. 2.3.2. Options in the Bash shell control the behavior and functionality of the shell, which can be set by the shopt command. Using the SET command is also possible, but it has been replaced by shopt, but in order to be backwards compatible, the SET command is still available. Use the shopt command without parameters to list the options that can be set only by shopt in the current shell, with Shopt-o to list the options that can be set by the set command.   The following are some of the basic options that are available by the SET command, which are turned off by default.  emacs                   Enter Emacs edit mode VI                     Enter VI edit mode ignoreeof               Do not allow the use of ctrl_d exit alone, to Use Exit. ignoreeof=10 equivalent noclobber               do not allow redirection to overwrite existing files Noglob         & nbsp       Do not allow extended file name wildcard Nounset                 use undefined variable given error below are some of the only shopt command to set options.  cdspell           automatically correct minor errors in the CD command parameters hostcomplete     At the beginning of @, press the TAB key to finish the hostname automatically DOTGBLOB         file names that start with a dot are included in the pathname extension mailwarn         Display the message warning message the options for the shopt command are as follows:  -p &nbs P         display can set options and current value-s           set each option to on-u           Set each option to off-q           do not output information-O This article was reproduced from: http://blog.163.com/wang_hai_fei/blog/static/309020312008728333912/ Thank you for the share of the author meanwhile, gravely despised without any declaration of reprint

Linux environment variables (pony recommended)

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.