Shell Learning Note-environment variable configuration file

Source: Internet
Author: User
Tags clear screen

One, the source command

Function: Read and execute commands in the configuration file in the current bash environment

1. Command format

Source configuration file or. Configuration file

2. Command examples
[Email protected] ~]# source/etc/#与上面的命令效果一样
Second, Global environment variable configuration file

The Global environment variable configuration file will take effect for all users.

1./etc/profile

Role:

1) Define the user variable, the logname variable, the mail variable, the path variable, the hostname variable, the histsize variable

2) define system default permissions Umask

3) Call the/etc/profile.d/*.sh file

2./etc/profile.d/*.sh3. /etc/bashrc

Role:

1) Define PS1 (Command prompt) variable

2) Umask

3) define the PATH variable

4) Call the/etc/profile.d/*.sh file

Third, user environment variable configuration file

Each user has the following two environment variable profiles, which are only valid for the user to which they belong.

1. ~/.bash_profile

Role:

1) Call the ~/.BASHRC file

2) Add ": $HOME/bin" directory after the PATH variable

2. ~/.BASHRC

Role:

1) define an alias alias for the RM CP MV

2) Call/ETC/BASHRC

IV. environment variable File execution flow

1. User login Normally, will be loaded from/etc/profile to/ETC/BASHRC

2. User non-normal login [not login Shell], such as through the SU Switch user, will start from/ETC/BASHRC, and finally to/etc/sysconfig/i18n

V. Other environment variable configuration file 1. ~/.bash_logout

The environment variable configuration file, which is in effect at logoff, is not normally used, and the commonly added commands include clear (clear screen), history-c (Empty History command).

Example:

2. ~/.bash_history

Operation history command to store files, only when logged off, the user logon process of the operation commands are written to the file, the command executed during the logon process is not immediately written to the file, but written in memory.

3./etc/issue

Local terminal welcome information, via remote login is not visible.

Example:

Login effect:

4./etc/issue.net

Remote Login Welcome Information

Note: If this welcome message is displayed, it is determined by the SSH configuration file (/etc/ssh/sshd_config), added "Banner/etc/issue.net" line to display, after joining, you need to restart the SSH service.

Example:

5./etc/motb

The welcome message can be displayed, either locally or remotely, after the login welcome message.

Shell Learning Note-environment variable configuration file

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.