User Tools

Site Tools


windows:wsl

This is an old revision of the document!


Windows Subsystem for Linux

To enable and install Windows Subsystem for Linux on Windows 10, run the following in an administrative PowerShell:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

You will be prompted to reboot. After rebooting, you can install your favorite Linux distribution(s) via the Microsoft Store.

Disable audible bell on terminal

Uncomment the following lines in /etc/inputrc:

# do not bell on tab-completion
set bell-style none
set bell-style visible

Using ssh-agent with multiple shell sessions

WSL doesn't run a full Linux system, rather it acts as an translation layer that can emulate the software interface required to run native Linux applications in the Windows kernel. Among the implications of this implementation is the fact that there is no good way start an ssh-agent session that is automatically shared all shell sessions in the same manner as a native Linux desktop.

These hacks allow successive shells to attach to the ssh-agent socket started by your first session.

These commands should be inserted in ~/.bashrc:

# start ssh-agent
SSHAGENTINFO=/tmp/${USER}-ssh-agent/info
if [ -f $SSHAGENTINFO ]; then
  printf "Reading ssh-agent socket info from %s.\n" $SSHAGENTINFO
  source $SSHAGENTINFO
else
  (umask 0077 ; mkdir -p `dirname $SSHAGENTINFO`; ssh-agent > $SSHAGENTINFO)
  source $SSHAGENTINFO
fi

To make sure that the session gets cleaned up, insert this in ~/.bash_logout:

# shut down our ssh-agent when we close the shell
ssh-agent -k && rm -f /tmp/${USER}-ssh-agent/info
windows/wsl.1565499690.txt.gz · Last modified: 2019-08-11 01:01 by gabriel