export
Processes and system
Usage
export VAR=valueMarks a variable so child processes inherit it; it dies with this shell, so put it in ~/.bashrc or ~/.zshrc to keep it, and a bare `VAR=x` without export stays invisible to the programs you run.
Common flags
| Flag | Meaning |
|---|---|
| VAR=value | Set it and mark it for export in one step. |
| -p | List everything currently exported. |
| -n <VAR> | Keep the variable but stop passing it to child processes. |
| -f <fn> | Export a shell function as well (bash). |
Examples
export PATH="$HOME/bin:$PATH"Put your own bin directory first for this session.
export AWS_PROFILE=stagingEvery command started afterwards in this shell sees it.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does export do?
Marks a variable so child processes inherit it; it dies with this shell, so put it in ~/.bashrc or ~/.zshrc to keep it, and a bare `VAR=x` without export stays invisible to the programs you run.
Q. How do I type it?
export VAR=value — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
4 are listed here; the full set is in man export. This command sits under Processes and system.
Related commands
man page: man export