If you install a software, after installation, enter the command, prompt "command not found", which involves the environment variable path problem. The path setting is a component of the custom environment variable under Linux.
Each user in Linux has a dedicated runtime environment, which is defined as a set of environment variables that users can customize to their own environment. The environment is closely related to the shell, and the user logs into the system and starts a shell, typically Bash,bash has two system-level profiles,/ETC/BASHRC and/etc/profile.
1, ECHO displays environment variables.
Echo $HOME #环境变量一般是大写
2,export Setting an environment variable
Export Myname=cmiao #这个环境变量是暂时的, after you launch the shell, it disappears.
3, modify an environment variable
Myname=miaoc
4, Show all environment variables
Env
5, use the SET command to display all locally defined shell variables.
Set
6, use unset to clear environment variables
Unset MYNAME
7. Modify environment variables by modifying the environment variable definition file
In your own home directory, execute VI. bash_profile
For example, edit your path declaration, path= $PAEH:<path1>:<path2>:<path3>:<path4> each path with: Separate, save and close.
Executes the source. Bash_profile
Use the Echo $PATH to view the current search path. As long as your command is in this path, it can be searched.
Variables modified by modifying the configuration file are permanent, while the variables declared with export are temporary and expire when the shell is closed.
Modify/etc/profile, Source/etc/profile. Valid for all users.
Modify. Bash_profile in the personal directory is valid only for the current user.