Question: I had problems with hostnames resolving in windows Linux-subsystem so I removed /etc/hosts and wrote new version of it. That solution solved my problem, but after every reboot system started overriding /etc/hosts by a some default version, so I need setup hosts again and again. 
Is it possible to setup linux subsystem so it copies original windows hosts file or at least doesn't delete already written file ?

Answer: 
```bsh
sudo vim /etc/wsl.conf

```

Add the following two lines:

```bsh
[network]
generateHosts = False

```

Reference: <https://devblogs.microsoft.com/commandline/automatically-configuring-wsl/>
I wrote the following zsh function based off of @R6D1H2's answer.

```
function addHosts() {
    declare -A MYHOSTS
    MYHOSTS=( 
        [host-1]="ip.add.re.ss"
        [host-2]="ip.add.re.ss"
        [host-3]="ip.add.re.ss"
        )

    for key value in ${(kv)MYHOSTS}; do
        grep $key /etc/hosts >> /dev/null || echo "$value $key" | sudo tee -a /etc/hosts >> /dev/null
    done
}

```