I've written a simple experiment which consists of cpp and shell. The main thing that cpp does is `execve("./test.sh", NULL, NULL);`, and shell tries to output environment variables as follows:

```
printenv
echo "PATH: $PATH"

```

It's quite expected that the environment is empty since I've sent no environment variables, but I get the following output:

```
PWD=/home/user/code/security_playground/display_path
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

```

So, first of all, the environment is not empty. Thus, the first question is how the environment is populated? What are defaults and minimal environment you could possibly get and where is it defined (if defined in config, etc.)?

Second question is where did PATH emerge from. It's not printed by `printenv`, but it's there if I print it with echo, and test.sh is still capable of calling utilities. Brief googling gave me an idea of `/etc/environment`, but it's contents is different:

```
└─$ cat /etc/environment                                                                                                                                                                   
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

```

Which, by the way, is surprisingly empty. Why?

I do realize that much of that should be somewhere in docs, but all my googling lead me to quite generic environment descriptions, so any answers or search hints are welcome.