📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Linux Command Line Environment Variables

Environment Variables

4 min read Quiz at the end
Environment variables store configuration. echo $PATH shows the search path. export VAR=value sets one for the current session. Add exports to ~/.bashrc to make them permanent. source ~/.bashrc applies changes.

Environment Variables

echo $HOME         # /home/alice
echo $PATH         # executable search path
echo $USER         # alice

# Set for session
export MY_VAR="hello"

# Set permanently
echo 'export MY_VAR="hello"' >> ~/.bashrc
source ~/.bashrc

# List all variables
printenv
env