If I export a variable in my terminal e.g.
$ export MY_VARIABLE=HelloWorld
where is it saved? Can I find it in the file system?
If I export a variable in my terminal e.g.
$ export MY_VARIABLE=HelloWorld
where is it saved? Can I find it in the file system?
I think you're misunderstanding what export does -- it doesn't "save" the variable at all, it just puts it in that shell process's environment, so it'll be inherited by programs that that shell launches. It has no affect on other running shells, programs launched other ways, and isn't permanent past when you exit that particular shell process.
Here's an example. The curl program will use proxies specified in environment variables like http_proxy. Suppose I do:
http_proxy=http://proxy.example.net/ # This won't work
curl http://www.example.com/
In this case, the http_proxy variable is only defined in the shell, and not inherited by the curl program, so it has no effect. On other other hand, if I run either:
export http_proxy=http://proxy.example.net/
curl http://www.example.com/
or
http_proxy=http://proxy.example.net/
export http_proxy
curl http://www.example.com/
...the export converts http_proxy into an environment variable, so it'll be inherited by the curl command (and other programs run by that shell), so curl will use that proxy.
But that's all export does! An exported variable has no presence outside of the process it's defined in, and subprocesses of that. It's not passed "up" the process tree to the process that launched the shell, or to any other shells or independent processes, and isn't really "stored" anywhere (other than the process data in memory).
People sometimes ask about setting an environment variable "permanently", but there isn't any such thing (at least in unix-like OSes, including macOS and Linux). The closest you can come is to add commands to set (and export) the variable in your shell startup files (maybe ~/.profile, ~/.bash_profile, ~/.bashrc, ~/.zprofile, ~/.zshrc, etc depending on which shell you use). This doesn't really make it permanent, it just re-creates it for each new shell process. (And even then, it won't have any presence in non-shell processes, like most cron jobs.)
If you're looking for a way to list your environment variables you can use printenv