Kinds:
? Set: Used to display local variables, display variables for the current shell, including variables for the current user
? ENV: Used to display environment variables and display variables for the current user.
? Export: Used to display and set environment variables to display the shell variables currently exported as user variables
Explain:
? Each shell has its own unique variable (set), which is different from the user variable, and the current user variable is not related to what shell you are using, no matter what shell you use, such as Home,shell, But the shell's own variable shell is different, such as BASH_ARGC, Bash, and so on, these variables only set will be displayed, is bash-specific, export does not add parameters, show which variables are exported to the user variables, Because a shell's own variable can be converted to a user variable by exporting "export"
Instance:
[[email protected] ~] # aaa=bbb [[email protected] ~] # echo $aaa bbb[[email protected] ~] # Set|grep AAA aaa=bbb[[email protected] ~]# Env|grep AAA [[email protected] ~]# Export AAA [[email protected] ~]# Env|grep AAA aaa=bbb
let's go back to the science. Environment variables:
1. What is an environment variable:
2. Why use environment variables?
3. What are the common environment variables?
1. What are environment variables?
? Linux is a multi-user operating system. After each user logs on to the system, there is a dedicated runtime environment. Typically, the default environment for each user is the same, and the default environment is actually the definition of a set of environment variables. Users can customize their own operating environment by modifying the appropriate system environment variables.
? An environment variable is an object with a specific name that contains the information that one or more applications will use. Many users, especially those who have just come into contact with Linux, find these variables somewhat bizarre or difficult to control. In fact, this is a misunderstanding: by using environment variables, you can easily modify a configuration information that involves one or more applications.
2. Why use environment variables?
In some software in the enable is the need to start the boot file, or some configuration files, so if the system can be found in the environment variables to find these files and use, it is equivalent to I tell the system where I want to use this thing is put, the system will be used by default from this path to take the things to use.
3. What are the common environment variables?
? PATH determines to which directories the shell will look for commands or programs
? Home Current User Home directory
Histsize refers to the number of records in which history commands are saved.
LogName refers to the login name of the current user. Hostname refers to the name of the host, and many applications are usually obtained from this environment variable if they want to use the hostname.
The shell refers to what kind of shell the current user is using.
Lang/languge is a language-related environment variable that users of multiple languages can modify.
Mail refers to the current user's message store directory.
PS1 is the basic prompt, for the root user is #, for the average user is $. PS2 is a secondary prompt and the default is ">". You can modify the current command by modifying this environment variable, such as the following command to modify the prompt to the string "Hello,my newprompt".
? The purpose of the CLASSPATH setting is to tell the Java execution Environment which directories can be used to find the classes or packages required by the Java program you want to execute.
Set,env and Export commands show the difference between shell variables, and environment variable literacy (i.)