Reputation: 5650
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?
Upvotes: 485
Views: 571750
Reputation: 1
Change default terminal to Python/Bash
Have given example for python below, you can do similar procedure to have the bash option appear in vs code. Search for User Profile Settings (JSON) in command palette (Ctrl+Shift+P): Then copy paste this code within the curly braces:
"terminal.integrated.profiles.windows": {
"Python": {
"path": "python",
"args": []
}
}
You can change the path variable to whichever terminal you want to use.
Now, open the command palette again and search for select default terminal, your new terminal should be an option there. Select it and every new terminal will be the cmd of your choice.
Upvotes: 0
Reputation: 558
Upvotes: 42
Reputation: 3027
To change the default terminal for your project in Visual Studio Code:
For example, if you are a Windows user and want to set "Command Prompt" as the default terminal you can write:
"terminal.integrated.defaultProfile.windows": "Command Prompt"
values. You can pass: "Git Bash"
, "PowerShell"
, and "Command Prompt"
.
For Linux, you will use terminal.integrated.defaultProfile.linux
and for macOS you will use: terminal.integrated.defaultProfile.osx
Upvotes: 9
Reputation: 1844
Since you use WSL, Visual Studio Code has the dedicated Remote - WSL extension, so you can use a Linux environment directly in Visual Studio Code.
When you open the project inside Linux, by default, it's using the Linux default shell (bash by default), so no configuration needed.
If you want to switch to other profile, there is Terminal → Integrated → Default Profile: Linux section, so you can pick your favorite one.
Upvotes: 5
Reputation: 314
The integrated shell option still works, but it has been deprecated. The fix is to use the integrated profile instead:
"terminal.integrated.profiles.windows": {
"C:\\Program Files\\Git\\bin\\bash.exe (migrated)": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe",
"args": []
}
}
Upvotes: 2
Reputation: 1114
Going off of arielhad's solution...
My Visual Studio Code version was 1.57.1.
Open the settings.json file:
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.
Upvotes: 5
Reputation: 2153
Configure your default integrated terminal by running the Terminal: Select Default Profile command, which is also accessible via the terminal dropdown.
See Terminal Basics.
Upvotes: 117
Reputation: 287
Press Ctrl + Shift + P. Then type settings.json.
At the end of the file, change the 'PowerShell' to 'Git Bash'.
Upvotes: 2
Reputation: 295
You can change the terminal by opening the Command Palette by pressing Ctrl + Shift + P.
Or you can go to View at the top and click "Open Command Palette".
Then type Terminal: Select Default Profile
And you can type which terminal you want.
Upvotes: 6
Reputation: 1407
Go to menu File → Preferences → Settings (or press Ctrl + ,). Then click the leftmost icon in the top right corner, "Open Settings (JSON)"
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 Visual Studio Code, it should open with Bash instead of PowerShell.
Upvotes: 40
Reputation: 27
If you want to select the type of console, you can write this in the file keybindings.json (this file can be found in the following path: menu 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"
}
Upvotes: 1
Reputation: 7100
I just type the following keywords in the opened terminal;
See details in the below image (Visual Studio Code version 1.19.1 on the Windows 10 OS):
It works on Visual Studio Code Mac as well. I tried it with Visual Studio Code (version 1.20.1).
Upvotes: 54
Reputation: 15631
You can also select your default terminal by pressing F1 in Visual Studio Code and typing/selecting Terminal: Select Default Profile
(or Terminal: Select Default Shell
in older Visual Studio Code versions).
Older:
Upvotes: 840