Skip to content

Instantly share code, notes, and snippets.

@zohaibhassan156
Last active April 24, 2023 04:22
Show Gist options
  • Save zohaibhassan156/e338c17262411979aa2ae7639bbf4021 to your computer and use it in GitHub Desktop.
Save zohaibhassan156/e338c17262411979aa2ae7639bbf4021 to your computer and use it in GitHub Desktop.
wsl2 bashrc and config options

Add this to /etc/wsl.conf file to enable systemctl commands

[boot]
systemd=true

To add composer global plugins to path

export PATH="~/.config/composer/vendor/bin:$PATH"

To share ssh-agent between terminals add this to .bashr

ssh-add -l &>/dev/null
if [ "$?" == 2 ]; then
  test -r ~/.ssh-agent && \
    eval "$(<~/.ssh-agent)" >/dev/null

  ssh-add -l &>/dev/null
  if [ "$?" == 2 ]; then
    (umask 066; ssh-agent > ~/.ssh-agent)
    eval "$(<~/.ssh-agent)" >/dev/null
  fi
fi

Add AddKeysToAgent to ssh config file ~/.ssh/config

Host *
        AddKeysToAgent yes
@zohaibhassan156
Copy link
Author

#set default user after wsl import distro
echo -e "[user]\ndefault=$myUsername" >> /etc/wsl.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment