How do I use Bash on Windows from the Visual Studio Code integrated terminal?

前端 未结 17 1838
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 00:28

Visual Studio Code on Windows uses PowerShell by default as the integrated terminal. If you want to use Bash from Visual Studio Code, what steps should be followed?

17条回答
  •  [愿得一人]
    2020-11-28 00:39

    Updated: Newer versions of Visual Studio Code have the Select Default Shell command in the terminal pull down menu:

    Remember that it just lists the shells that are in your %PATH% environment variable. For shells that aren't in your path, see other answers.

    Extra tip: when you start bash it will just execute .bashrc, if you have initialization commands in .bash_profile you must copy it to .bashrc. It's essential for using Conda enviroments in Git Bash.

    Before version 1.36 (June 2019)

    The easiest way now (at least from Visual Studio Code 1.22 on) is to type Shift + Ctrl + P to open the Command Palette and type:

    Select Default Shell
    

    Now you can easily select your preferred shell between the ones found in your path:

    For shells that aren't in your %PATH%, see the other answers.

    See the complete Visual Studio Code shell reference. There's lot of meaty stuff.

提交回复
热议问题