WSL config

These are some general configuration values I keep in most Windows Subsystem for Linux instances. The config file location is /etc/wsl.conf.

[network]
generateResolvConf=false
[automount]
options = "metadata"

I use this command to define the default user when opening a WSL terminal (the executable may depend on the distribution, like “ubuntu1804” or “ubuntu2004” for example):

ubuntu1804 config --default-user zeryther

I use this to create a quick symlink to my workspace directory (in my Windows fs). The /mnt/d/ path is mounting the D: drive in my case. For understanding: The Windows path is D:\workspace. If your workspace path was something like F:\programming\workspace, the WSL path would be /mnt/f/programming/workspace.

ln -s /mnt/d/workspace/ ~/workspace

Update 01.03.2022: Turns out using the mounted drive for your workspace is actually not a good idea and ass slow. I have since changed my approach and keep my workspace in the WSL file system. To access the workspace from your Windows file explorer, run the following command in your WSL shell to find the path:

wslpath -w .

I append this to the ~/.bashrc file to automatically change directory to my workspace:

cd ~/workspace