# Variables

Local variables and environmental variables&#x20;

To differentiate further:

* **Local Variables**:
  * Are defined and accessed only within the shell they are created in.
  * Serve as temporary storage for data used in scripts or during interactive shell use.
  * Do not affect the system-wide state or other shell sessions.
  * Local is only available in the shell it is created in; it is user-specific.
* **Environment Variables**:

  * Can be inherited by child processes; for instance, when a script runs a command, the environment variables from the script can be accessed by that command.
  * Are used to configure the environment in which applications or shell scripts run.
  * Common examples include `PATH`, `HOME`, `USER`, and `LANG`, each serving specific roles like specifying directories to search for executables or defining default user locales.
  * Environmental / Gloabel is available to the whole system. This is located in /etc&#x20;

  <figure><img src="https://3601924473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgFpI6H35EMjG52w5PcIP%2Fuploads%2F2TV5z9qnXFa00JUxTqKc%2Fimage.png?alt=media&#x26;token=9b07b0d0-f8d2-43ae-8ecb-19fa90c6344b" alt=""><figcaption></figcaption></figure>

As you can see in the image above, the variable GEEKSFORGEEKS is being set for SITE; then, you are using grep to post the output of SITE. To see more documentation on variables and how they work in Linux, look at the [GeekforGeeks](https://www.geeksforgeeks.org/shell-scripting-shell-variables/) documentation they posted. It is beneficial and makes understanding variables easy.&#x20;
