> For the complete documentation index, see [llms.txt](https://sahilwep.gitbook.io/veilsec/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sahilwep.gitbook.io/veilsec/oscp-notes/command-line-fun/bash-environment.md).

# Bash Environment

Bash is a programing language.

* Bash is an sh-compatible shell that allows us to run complex commands and perform different tasks from a terminal window.&#x20;
* we can directly run our command in terminal  or save in file with .sh and then run it.

Terminal&#x20;

![](https://3989642013-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz4O59jPTfyNTpTEwEhZa%2Fuploads%2F6RRRxxAiYwPOWnU25ktl%2Fimage.png?alt=media\&token=02b24caf-d7a6-46fa-99a2-5faa1b8215a5)

## Environment Variable

* When opening a terminal window, a new Bash process, which has its own environment variables, is initialized.
* &#x20;These variables are a form of global storage for various settings inherited by any applications that are run during that terminal session.
* &#x20;One of the most commonly-referenced environment variables is **PATH**, which is a colon-separated list of directory paths that Bash will search through whenever a command is run without a full path.

```bash
┌──(root💀rio)-[~]
└─# echo $PATH
/root/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/snap/bin:/snap/bin/spotify
                                                                                                                                      
```
