Bash's environment variables

Source: Internet
Author: User

1 Viewing the system's environment variables Env,export

linux-m0vk:~ # exportdeclare -x colorterm= "1" declare -x cpu= "x86_64" declare  -x cshedit= "emacs" declare -x cvs_rsh= "ssh" declare -x display= "localhost:10.0" declare -x env= "/ETC/BASH.BASHRC" declare -x from_header= "" Declare -x g_broken_ filenames= "1" declare -x g_filename_encodingdeclare -x histsize= "declare -x " Home= "/root" declare -x host= "Linux-m0vk" declare -x hostname= "LINUX-M0VK" declare -x  hosttype= "x86_64" declare -x inputrc= "/etc/inputrc" declare -x lc_ctype= "En_US". UTF-8 "declare -x lessclose=" lessclose.sh %s %s "declare -x lesskey="/etc/ Lesskey.bin "declare -x lessopen=" lessopen.sh %s "declare -x less_advanced_preprocessor = "No" declare -x logname= "root" declare -x path= "/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/ usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/x11r6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin "declare -x pwd="/root "declare  -x shell= "/bin/bash" declare -x user= "root"
linux-m0vk:~ # envlesskey=/etc/lesskey.binnntpserver=newsinfodir=/usr/local/info:/usr/share/info:/usr/ infomanpath=/usr/share/man:/usr/local/manhostname=linux-m0vkhost=linux-m0vkterm=linuxshell=/bin/ bashprofileread=truehistsize=1000ssh_client=192.168.10.166 62195 22ssh_tty=/dev/pts/1user=rootenv=/etc/ bash.bashrchosttype=x86_64mail=/var/mail/rootpath=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/ usr/bin:/bin:/usr/bin/x11:/usr/x11r6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbincpu=x86_64inputrc=/etc/ Inputrcpwd=/roothome=/rootlc_ctype=en_us. utf-8ssh_connection=192.168.10.166 62195 192.168.10.183 22lessopen=lessopen.sh%sinfopath=/usr/local/info:/usr/ Share/info:/usr/infodisplay=localhost:10.0xauthlocalhostname=linux-m0vklessclose=lessclose.sh%s%sG_BROKEN_ Filenames=1colorterm=1_=/usr/bin/env

2 Viewing all variables of the system: set

To clear the value of an environment variable by: unset

linux-m0vk:~ # export Lang=enlinux-m0vk:~ # env| grep langlang=enlinux-m0vk:~ # unset langlinux-m0vk:~ # env| grep LANG


3 environment variable definition file:/etc/profile

Export keyword = variable; If a duplicate variable is defined in the profile, it is the variable that is written after it works; special characters in Profile: Semicolon (:), $ {Path=/sbin:/usr/sbin:/usr/local/sbin Like here the semicolon: the meaning of a side-by-side, when there are more than one variable is worth separated by semicolons Path=/sbinpath=/bin: $PATH is equivalent to path=/bin:/sbin here the $path refers to the previous PATH variable. The content added or modified in profile needs to be re-written off before the system takes effect, if you want to take effect immediately please run: source/etc/profile

4 Common environment variable keywords:

Path definition of a command or program home current user's home directory mail current user the directory in which the shell currently uses the Shellhistsize History command to record the number of entries logname the current user's logon name hostname host name Lang current S Hell uses the character encoding PS1 basic prompt, for the root user is #, for the normal user is the $PS2 secondary prompt, the default is to see the prompt when the line is changed >


5 . Modify the environment variables in the/etc/profile file, where the content is modified to work for all users.

Modify the. bashrc file under the user root to edit the environment variables, which are useful only to the current user



This article is from the "Tiandaochouqin" blog, make sure to keep this source http://8855546.blog.51cto.com/8845546/1642057

Bash's environment variables

Related Article

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.