3

The "Bash on Ubuntu on Windows" application always starts, well, bash. I have used chsh to set another shell as my login shell. How do I get WSL to start that shell instead?

3 Answers 3

4

This is fixed in a currently Insider-only build, with the new wsl.exe command:

As of build 16188 when running bash.exe without arguments (or with the ~ argument) bash will be launched as a login shell. The same is true for the new wsl.exe binary (with the exception that wsl launches your user's default shell as a login shell).

Prior to this, you'd have to edit the shortcut to add command-line parameters (such as -c 'exec "$SHELL" -l'):

2
2

A bit of historical context for anyone attempting to add a new answer nowadays. This question was originally asked back in the dark-ages-of-early-WSL. Back then:

  • Ubuntu/WSL was known as "Bash on Ubuntu on Windows"
  • It was launched via the bash.exe command
  • It always launched the Bash shell

The bash.exe command was deprecated a while back and replaced with the wsl.exe command that @muru mentioned in this answer.

Now, you can change your default/login shell to Fish (or typically any other shell) using the standard Ubuntu methods mentioned, for example, in this answer. In short:

  • Make sure the shell is represented in your /etc/shells
  • chsh -s <path_to_shell>
  • Or typically, chsh -d $(which fish)
-1

To launch, e.g., fish in Ubuntu in WSL, set your target to

C:\Windows\system32\wsl.exe --distribution Ubuntu --exec fish
3
  • 1
    Welcome to Ask Ubuntu! This really doesn't answer the question that was asked, which was how to change the login shell. Back in 2017 when this question was asked, Ubuntu/WSL was launched via the bash.exe command, and it always launched Bash. Now (and for quite a few years), the wsl command will launch whatever shell is set with chsh as this answer mentioned was "coming soon" at the time. You can use the method you mention to do a "one time" launch of Fish, but changing the login shell requires another method. Mar 22 at 20:47
  • Oh, okay. I was specifically looking for how to set the WSL starting shell from a launch target, and this seemed to be the most relevant question at the time.
    – nupanick
    Mar 29 at 23:16
  • That makes sense - Suggestion, though - This would be a good answer to this question. I'd delete the answer here and post it there instead. I'll help edit your answer there to be clear, since the original question there mentions ubuntu.exe rather than wsl.exe. Mar 30 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .