VSCode Change Default Terminal

BashPowershellCmdTerminalVisual Studio-Code

Bash Problem Overview


I am using Visual Studio Code on my Windows 10 PC. I want to change my default terminal from Windows PowerShell to Bash on Ubuntu (on Windows).

How can I do that?

Bash Solutions


Solution 1 - Bash

You can also select your default terminal by pressing F1 in VS Code and typing/selecting Terminal: Select Default Profile (or Terminal: Select Default Shell in older VSCode versions). Terminal Selection 3

Older: Terminal Selection

Terminal Selection

Solution 2 - Bash

Configure your default integrated terminal by running the Terminal: Select Default Profile command, which is also accessible via the terminal dropdown.

enter image description here

See https://code.visualstudio.com/docs/editor/integrated-terminal#_terminal-profiles

Solution 3 - Bash

I just type following keywords in the opened terminal;

  1. powershell
  2. bash
  3. cmd
  4. node
  5. python (or python3)

See details in the below image. (VSCode version 1.19.1 - windows 10 OS) enter image description here

It works on VS Code Mac as well. I tried it with VSCode (Version 1.20.1)

Solution 4 - Bash

Go to File > Preferences > Settings (or press Ctrl+,) then click the leftmost icon in the top right corner, "Open Settings (JSON)"

screenshot showing location of icon

In the JSON settings window, add this (within the curly braces {}):

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe"`

(Here you can put any other custom settings you want as well)

Checkout that path to make sure your bash.exe file is there otherwise find out where it is and point to that path instead.

Now if you open a new terminal window in VS Code, it should open with bash instead of PowerShell.

Solution 5 - Bash

Going off of @arielhad's solution...

My VSCode version was 1.57.1.

Open settings.xml file:

  • Ctrl + Shift + p
  • Type 'Open Settings (JSON)' and select.

Add the following:

"terminal.integrated.profiles.windows": {
    "PowerShell": {
        "path": [
            "${env:windir}\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
            "${env:windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        ],
        "source": "PowerShell",
        "icon": "terminal-powershell",
        "args": [
            "-NoLogo",
            "-ExecutionPolicy",
            "Bypass"
        ]
    },
    "Command Prompt": {
        "path": [
            "${env:windir}\\Sysnative\\cmd.exe",
            "${env:windir}\\System32\\cmd.exe"
        ],
        "icon": "terminal-cmd"
    },

//START: THIS DOES NOT WORK
    "Git Bash": {
        "path": [
            "C:\\Program Files\\Git\\bin\\bash.exe",
        ],
        "source": "Git Bash",
        "icon": "terminal-bash"
    }
// END: THIS DOES NOT WORK

//START: THIS WORKS
    "GitBash": {
        "path": [
            "C:\\Program Files\\Git\\bin\\bash.exe",
        ],
        "icon": "terminal-bash"
    }
// END: THIS WORKS
}

I don't know why the second way works but it does. It appears the 'Git Bash' is a reserved name and I guess you cannot set the path.

Solution 6 - Bash

Since you use WSL, VSCode has dedicated Remote - WSL extension so you can use Linux environment directly in VSCode. When you open the project inside Linux, by default, it's use Linux default shell (bash by default), so no config needed.

If you want to switch to other profile, there is Terminal > Integrated > Default Profile: Linux section so you can pick your favorite one.

Linux Terminal Profiles

Solution 7 - Bash

If you want to select the type of console, you can write this in the file "keybinding.json" (this file can be found in the following path "File-> Preferences-> Keyboard Shortcuts") `

//with this you can select what type of console you want
{
    "key": "ctrl+shift+t",
    "command": "shellLauncher.launch"
},

//and this will help you quickly change console
{ 
    "key": "ctrl+shift+j", 
    "command": "workbench.action.terminal.focusNext" 
},
{
    "key": "ctrl+shift+k", 
    "command": "workbench.action.terminal.focusPrevious" 
}`

Solution 8 - Bash

The integrated shell option still works but has been depreciated. The fix is to use the integrated profile instead:

    "terminal.integrated.defaultProfile.windows": "C:\\Program Files\\Git\\bin\\bash.exe (migrated)",
    "terminal.integrated.profiles.windows": {
        "C:\\Program Files\\Git\\bin\\bash.exe (migrated)": {
            "path": "C:\\Program Files\\Git\\bin\\bash.exe",
            "args": []
        }
    }

Solution 9 - Bash

You can change the terminal by opening command pallete by pressing CTRL SHIFT P

or you can go to View in the top and click "Open Command Pallete"

then type Terminal: Select Default Profile

and you you type which terminal you want.

Solution 10 - Bash

press ctrl+Shift+p -> type settings.json at the of file change the 'powershell' to 'Git Bash'

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionabhijeetpsView Question on Stackoverflow
Solution 1 - BashLevi FullerView Answer on Stackoverflow
Solution 2 - BasharielhadView Answer on Stackoverflow
Solution 3 - BashAnandShanbhagView Answer on Stackoverflow
Solution 4 - BashA. LarssonView Answer on Stackoverflow
Solution 5 - BashChuck LView Answer on Stackoverflow
Solution 6 - BashTan NguyenView Answer on Stackoverflow
Solution 7 - BashJhon Stiven Guevara VelascoView Answer on Stackoverflow
Solution 8 - BashStephanieraymosView Answer on Stackoverflow
Solution 9 - BashMichael RusuView Answer on Stackoverflow
Solution 10 - BashMohammed Shabeer kView Answer on Stackoverflow