In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the types of environmental variables in the Linux system, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
An environment variable is an object with a specific name that contains information that one or more applications will use. By using environment variables, you can easily modify configuration information that involves one or more applications.
The types of linux variables are divided according to the life cycle of variables. Linux variables can be divided into two categories: 1 permanent: the configuration file needs to be modified and the variable takes effect permanently. 2 temporary: you can declare it with the export command, and the variable becomes invalid when the shell is closed.
Three ways to set variables 1. Add a variable to the / etc/profile file [effective for all users (permanent)] use VI to add a variable to the file / etc/profile file, which will be valid for all users under Linux and will be "permanent".
For example: edit / etc/profile file, add CLASSPATH variable
Vi / etc/profile 1 is added at the end
Export CLASSPATH=./JAVA_HOME/lib;$JAVA_HOME/jre/lib or export PATH= "/ opt/STM/STLinux-2.3/devkit/sh5/bin:$PATH" 123Note: if you want to change the file to take effect immediately, you have to run # source / etc/profile or it will only take effect the next time you re-enter this user. Note: generally, only root users have editing rights.
two。 Add a variable to the. bash_profile file in the user directory [effective for a single user (permanent)] use VI to add a variable to the. bash_profile file in the user directory, and the change is valid only for the current user and is "permanent".
For example: edit the. bash_profile under the guok user directory (/ home/guok)
Vi / home/guok/.bash.profile or v ~ / .bash.profile 123 add the following:
Export CLASSPATH=./JAVAHOME/lib;JAVA_HOME/jre/lib 1 Note: if you want to change the file to take effect immediately, you have to run $source / home/guok/.bash_profile, otherwise it will only take effect the next time you reenter this user.
3 run the export command directly to define the variable [valid for the current shell (BASH) only (temporary)] use [export variable name = variable value] directly under the command line of shell to define the variable
This variable is valid only under the current shell (BASH) or its child shell (BASH)
When shell is turned off, the variable becomes invalid, and you don't have it when you open a new shell, and you need to redefine it if you need to use it.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
These are the types of environment variables in the Linux system, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow 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: 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.