export

Set an environment variable for the programs you run

What it does

export NAME=value creates a variable and makes it visible to the programs you start from this terminal: that is how Node.js learns NODE_ENV, and tools get keys and addresses. No spaces around =.

The variable lasts until the terminal closes. To keep it for good, add the export line to ~/.bashrc (~/.zshrc in zsh). For a single run, put the variable right before the command: NODE_ENV=test npm test.

Syntax

export <NAME>=<value>
<NAME>=<value> <command>

Examples

Related commands

Practise · All commands