VSCode Change Default Terminal

309,704

Solution 1

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

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

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

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

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

Share:
309,704

Related videos on Youtube

abhijeetps
Author by

abhijeetps

Software Engineer

Updated on July 05, 2022

Comments

  • abhijeetps
    abhijeetps almost 2 years

    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?

  • winterlight
    winterlight over 5 years
    Seems to work only when bash is selected as default shell.
  • sorin
    sorin over 5 years
    As of today on MacOS the Terminal extension does not have a "Select Default Shell" option in the menu! Lucky for me using stackoverflow.com/a/49916667/99834 worked.
  • Barabas
    Barabas over 5 years
    Without this extension Shell launcher this answer is useless. So just install it and specify shortcut. Be careful, this shortcut is already defined - find this shortcut and check if you use action under this shortcut or not.
  • dmoore1181
    dmoore1181 almost 5 years
    It appears that VSCode has changed a little since this answer, now there is a button with {} on it that you must press to get to the editor to make this change. The command in this answer did work correctly. Thank you for the answer.
  • cakidnyc
    cakidnyc over 4 years
    I'm using MacOS Catalina right now, "Terminal: Select Default Shell" was there and worked for me.
  • Ollie
    Ollie over 3 years
    Was searching for a way to open my wsl on windows without changing the default, creating new, then switching default back to powershell. Simply typing wsl works an absolute charm
  • Sergio Escudero
    Sergio Escudero about 3 years
    You should not use the executable from System32 since (normally) vs code has no access to that executable. Instead use the program files one terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
  • Sergio Escudero
    Sergio Escudero about 3 years
    Outdated answer. Not working for the new VS code versions
  • Meeting Attender
    Meeting Attender almost 3 years
    This is the correct and most recent way of doing it, however, it doesn't work for me in VS Code v1.56.2. This works "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe"
  • arielhad
    arielhad almost 3 years
    When im trying to use "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe" Im getting this warning - "This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile" (VS Code v1.56.2)
  • Meeting Attender
    Meeting Attender almost 3 years
    I’m getting the same deprecated warning but at least it works. Like I said recommended way isn’t working for me on v1.56.2.
  • Drovosek
    Drovosek almost 3 years
    Not work for me in VSCode 1.56.2 too. Use deprecated way, it works.
  • Kevin Danikowski
    Kevin Danikowski almost 3 years
    Updated Answer for Linux and MAC: askubuntu.com/a/1118140/810954
  • Ray Foss
    Ray Foss almost 3 years
    There is a Small drop down that says Select Default Profile... that sets the current shell as the default profile.
  • Abhishek Dutt
    Abhishek Dutt almost 3 years
    Lol, what makes this answer different from @OneShadow 's answer. Please elaborate more on it.
  • Chuck L
    Chuck L almost 3 years
    Not working in VSCode 1.57.1, HOWEVER, if you remove "source": "Git Bash" AND change the name from "Git Bash" to something like "GitBash", it works. Is there a bug???
  • Jatin Mandanka
    Jatin Mandanka over 2 years
    Worked like a charm . Thanks.
  • Olli
    Olli over 2 years
    "terminal.integrated.shell.windows" or "terminal.integrated.shell.linux" is deprecated and it did not seem to work in my case (v1.62.0 on linux). Use "terminal.integrated.defaultProfile.windows" or "terminal.integrated.shell.linux" instead and define the executable path in the "terminal.integrated.profiles.windows" or "terminal.integrated.profiles.linux", repectively. See also @Stephanieraymos answer below.
  • heretoinfinity
    heretoinfinity about 2 years
    Has this changed because I have done this on Windows version 1.65.2 and every time there is a restart, I get the powershell instead of Git bash
  • Timo
    Timo about 2 years
    It should be the correct answer, because the OP wants to switch from Windows to Linux in Vscode which is only possible with Remote WSL I guess.
  • Timo
    Timo about 2 years
    I have terminal.integrated.defaultProfile.linux and terminal.integrated.defaultProfile.windows and terminal.integrated.defaultProfile.osx. The magic three..
  • amordo
    amordo almost 2 years
    I set fish as default shell on wsl, but vscode still used bash. Set this setting explicitly and now it works like a charms, ty!