Environment Variables
What are Environment Variables?
Environment variables are dynamic values stored in the operating system that affect program behavior and how the system runs.
Viewing Environment Variables
Common Environment Variables
Setting Environment Variables
Temporary Setting
Permanent Setting
User-level Configuration
Edit ~/.bashrc or ~/.profile:
System-level Configuration
PATH Variable
PATH is one of the most important environment variables, defining the directories that Shell searches for commands.
Viewing PATH
Modifying PATH
PATH Search Order
Language and Region Settings
Common Configuration Examples
Development Environment
Proxy Settings
Shell Variables vs Environment Variables
Summary
This chapter introduced environment variables:
- Viewing variables:
env,printenv,echo - Setting variables:
export, configuration files - PATH variable: Command search paths
- Configuration files:
~/.bashrc,/etc/environment - Language settings: locale
- Configuration examples: Development, proxy settings
Environment variables are an important way to configure系统和应用程序。Mastering them will greatly improve your efficiency.
Previous chapter: Shell Scripting Basics
Next chapter: Practical Examples