In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the difference between bashrc and profile under Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the difference between bashrc and profile under Linux?"
After logging in to the console of the Linux operating system using the terminal ssh, a prompt symbol (for example: # or ~) appears. After this prompt symbol, you can enter a command, and Linux will respond according to the command entered. This series of actions are handled by a so-called Shell.
Shell is a program, the most commonly used is Bash, which is also the default Shell used by the login system.
Both bashrc and profile are startup settings files for Shell (in fact, these two files are also Shell scripts), which can initialize environment variables for the current Shell, and so on, which are similar to the autoexec.bat files under Microsoft DOS/Windows.
The uses and differences between bashrc and profile are described in detail below:
For individual users
.bashrc # ~ / .bashrc: executed by bash (1) for non-login shells. .profile # ~ / .profile: executed by Bourne-compatible login shells.
For all users
/ etc/bash.bashrc # System-wide .bashrc file for interactive bash (1) shells. / etc/profile # / etc/profile: system-wide .profile file for the Bourne shell (sh (1)
The difference between bashrc and profile
As can be seen from the English description above, the difference between bashrc and profile lies in:
1. Bashrc runs automatically after the system starts.
2. Profile will not run until the user logs in.
3. After setting up, you can use the source bashrc command to update bashrc, or you can use the source profile command to update profile.
PS: usually we modify bashrc. Some distributions of linux do not necessarily have the file profile.
4. The variable (global) set in / etc/profile can act on any user, while the variable (local) set in ~ / .bashrc and so on can only inherit the variable in / etc/profile, they are "father-son" relationship.
Supplementary introduction
In addition, additional notes are needed to introduce several files related to bashrc:
~ / .bash_profile: each user can use this file to enter shell information dedicated to their own use. When the user logs in, the file is executed only once! By default, he sets some environment variables to execute the user's .bashrc file.
~ / .bash_logout: this file is executed each time you exit the system (exit bash shell).
~ / .bash_profile is interactive, login mode into the bash operation, ~ / .bashrc is interactive non-login mode into the bash operation, usually the two settings are roughly the same, so usually the former will call the latter.
At this point, I believe you have a deeper understanding of "what is the difference between bashrc and profile under Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.