Intermediate Package: bash builtin

export

Set an environment variable for the current shell and its child processes.

Syntax

export VARIABLE=value

Description

export marks a shell variable as an environment variable, meaning any program launched from this shell — not just the shell itself — will be able to see it. Commonly used for things like PATH, EDITOR or API keys.

Examples

export EDITOR=vim
Set an environment variable for this session
export PATH=$PATH:/opt/myapp/bin
Add a directory to your PATH
export
List every currently exported variable
Variables set with export only last for the current session unless also added to a shell startup file like ~/.bashrc.

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux