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 about how to view environment variables under Linux. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
Environment variables are equivalent to "shortcut keys," specifying a directory that the program will look for when running the software
1. Linux View Environment Variables Display Environment Variables HOME
$ echo $HOME/home/redbooks2. Linux View environment variables Set a new environment variable hello
$ export HELLO="Hello! " $ echo $HELLO Hello! 3. Linux View environment variables Use env command to display all environment variables
$ env HOSTNAME=redbooks.safe.org PVM_RSH=/usr/bin/rsh SHELL=/bin/bash TERM=xterm HISTSIZE=1000 …4. Linux View environment variables Use the set command to display all locally defined Shell variables
$ set BASH=/bin/bash BASH_VERSINFO=([0]="2″[1]="05b"[2]="0″[3]="1″[4]="release"[5]="i386-redhat-Linux-gnu") BASH_VERSION=’2.05b.0(1)-release’ COLORS=/etc/DIR_COLORS.xterm COLUMNS=80 DIRSTACK=() DISPLAY=:0.0 …5. Linux View environment variables Use the unset command to clear the environment variable set to set the value of an environment variable. Clear the value of an environment variable with the unset command. If no value is specified, the variable value is set to NULL. Examples are as follows:
$ export TEST="Test…" #Add an environment variable TEST $ env| grep TEST #This command has input, proving that the environment variable TEST already exists TEST=Test… $ unset $TEST #Delete the environment variable TEST $ env| grep TEST #This command has no output, proving that the environment variable TEST already exists 6. Linux View environment variables Use readonly to set readonly variables If readonly is used, variables cannot be modified or cleared. Examples are as follows:
$ export TEST="Test…" #Add an environment variable TEST $ readonly TEST #Set the environment variable TEST to readonly $ unset TEST #You will find that this variable cannot be deleted-bash: unset: TEST: cannot unset: readonly variable $ TEST="New" #You will find that this variable cannot be modified-bash: TEST: readonly variable The setting of the environment variable is located in the/etc/profile file
Thank you for reading! About "how to view environment variables under Linux" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.