The export command

Set export attribute for shell variables. 11 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.

Examples

export MYNAME="IVski"

Environment variable (inherited by subprocesses)

export PATH="$PATH:/new/directory"

Temporary (this session)

export PATH="$HOME/.local/bin:$PATH"

Add to front (higher priority)

export PATH="$HOME/scripts:$PATH"
export EDITOR=nano
export PS1='\[\033[1;32m\]\u@\h\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]\$ '
export HISTSIZE=10000
export HISTFILESIZE=20000
export HISTCONTROL=ignoredups:erasedups
export HISTCONTROL=ignoredups

No duplicate entries

export HISTTIMEFORMAT="%F %T "

Add timestamps

Lessons that use export