Linux export command

When you’re managing your shell’s variables and you wish to save them to your environment you can use the export command. In this article, we will show you the basic usage of the Linux export command.

cPanel Hosting from WebhostFace

Basic export usage

MY_VARIABLE=42
export MY_VARIABLE

Editing your Linux user’s PATH

PATH=/path/to/add:$PATH
export PATH

Exporting a function

function MY_FUNC() {
    echo "In MY_FUNC"
}
export -f MY_FUNC

Master your Linux knowledge with our List of Top Linux Commands for Beginners and Experts. Test different Linux commands on a Linux Dedicated server, Private VPS or an SSH Shared Hosting account now!