Linux on the difference between BASHRC and profile (RPM)

Source: Internet
Author: User
Tags terminates

the difference between BASHRC and profile is to understand the difference between BASHRC and profile, first of all to figure out what is interactive shell and non-interactive shell, what is login shell and non-login Shell. The interactive mode is where the shell waits for your input and executes the commands you submit. This pattern is called interactive because the shell interacts with the user. This mode is also familiar to most users: Log in, execute some commands, and check back. When you sign back, the shell also terminates. The shell can also run in a different mode: non-interactive mode. In this mode, the shell does not interact with you, but instead reads the commands stored in the file and executes them. When it reads the end of the file, the shell terminates. BASHRC and profile are used to save the user's environment information, BASHRC for interactive non-Loginshell, while profile is used for interactive login shell. There are many BASHRC and profile files in the system, which are described below:/etc/Pro This file sets the environment information for each user of the system, and when the first user logs on, the file is executed. and from/etc/The configuration file of the PROFILE.D directory collects the shell settings./ETC/BASHRC: Executes this file for each user running the bash shell. When the bash shell is opened, the file is read. Some versions of Linux/the BASHRC file is not already in the ETC directory. ~/. Pro Each user can use this file to enter shell information dedicated to their own use, and when the user logs in, the file executes only once!by default, it sets some environment variables and then executes the user's. bashrc file.~/. BASHRC: This file contains bash information dedicated to a user's bash shell, which is read when the user logs on and every time a new shell is opened. In addition,Variables set in/etc/profile (global) can be applied to any user, while variables set in ~/.BASHRC and so on (local) can only inherit variables from/etc/profile, they are"Father"relationships. A netizen summarizes as follows:/etc/profile,/etc/BASHRC is the system Global environment variable setting~/.profile,~/. BASHRC private environment variable in user home directory when a shell process is obtained when logging into the system, its read environment profile has three steps 1 first read in the Global environment variable profile/etc/Profile , and then read the additional set of documents based on its contents, such as/ETC/PROFILE.D and/etc/Inputrc2 and then according to different user account, go to their home directory read~/.bash_profile, if this can't be read, read ~/.. Bash_login, this can't be read.~/. Profile, these three document settings are basically the same, reading has a precedence relationship of 3 and then is read according to the user account~/. BASHRC as to~/.profile and ~/the BASHRC is individually customizable.~/. Profile can set the user's proprietary path, environment variables, etc., it only executes once when it is logged in~/.BASHRC is also a user-specific settings document, you can set the path, command alias, each time the shell script execution will use it once

Linux on the difference between BASHRC and profile (RPM)

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.