Lesson 19 / 29

Environment Variables

Named values every process can read.

What an env var is

An environment variable is a named value available to a shell and the processes it starts — used for config like EDITOR, HOME, or PATH.

export & echo

export sets a variable and makes it visible to child processes; $VAR reads it back.

export EDITOR=vim
echo $EDITOR
env | grep EDITOR

Output:

vim
EDITOR=vim

.bashrc vs .profile

~/.bashrc runs for every new interactive shell; ~/.profile runs once at login. Put persistent export lines there so they survive a restart.