In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge about how to look at the environmental variables of linux. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
Linux environment variables have two locations: 1, bashrc, profile and environment files under the "/ etc" directory, which are configured environment variables; and 2, ".bashrc" and ".bash _ profile" files under the user directory, both of which are hidden files.
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Where are the environment variables of linux
1. System location, bashrc, profile and environment files in / etc directory
2. The .bashrc and .bash _ profile files under the user directory (root or ordinary user). Note that both files are hidden files.
Let's start with these three system files and list the contents of the files (see CentOS7). / * / to add comments
# / etc/bashrc# System wide functions and aliases / * extensive system functions and aliases * / # Environment stuff goes in / etc/profile / * Environment things (environment variables) in the / etc/profile file * / / * it's not a good idea to modify this file unless you know what you're doing. * / / * creating a custom script in the / etc/profile.d/ directory would be a better way to modify environment variables * / / * but it would prevent the need for merging in future updates * / # It's NOT a good idea to change this file unless you know what you# are doing. It's much better to create a custom.sh shell script in# / etc/profile.d/ to make custom changes to your environment, as this# will prevent the need for merging (merge) in future updates. # / etc/profile# System wide environment and startup programs, for login setup# Functions and aliases go in / etc/bashrc# It's NOT a good idea to change this file unless you know what you# are doing. It's much better to create a custom.sh shell script in# / etc/profile.d/ to make custom changes to your environment, as this# will prevent the need for merging in future updates.
The third file environment file opens is an empty file, not a table.
Say two more user files, paste the contents of the file (see CentOS7) / * / to add comments
Ordinary users:
Root user
# .bashrc # User specific aliases and functions / * user-specified aliases and functions (functions) * / alias rm='rm-i'alias cp='cp-i'alias mv='mv-iTunes # Source global definitionsif [- f / etc/bashrc]; then. / etc/bashrcfi# .bash _ profile# Get the aliases and functions / * get aliases and functions (functions) * / if [- f ~ / .bashrc]; then. ~ / .bashrcfi # User specific environment and startup programs / * user-specified environment variables and startup program (where is the linux boot startup program placed? Haven't tried yet) * / PATH=$PATH:$HOME/binexport PATH
The comments of these files have made it clear that bashrc files are aliases and functions (functions) specified by the user, bash_profile files are used to obtain aliases and functions (functions) in bashrc files, and users can also specify environment variables and boot startup programs in this file. The system's bashrc, and bash_profile files make it clear that creating a custom script in the / etc/profile.d/ directory is a better way to modify environment variables. As shown in the figure:
These are all the contents of the article "what do you think of the environmental variables of linux"? thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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: 235
*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.