85

When using Visual Studio Code, how do I run command-line programs, such as a choco (Chocolatey) command? Do I need to have a separate Command Line (CMD.exe) running outside VS Code, or is there a hotkey/window within Code where I can run those commands?

I see the "Command Palette", but it is not entirely clear what command engines run in that palette.

5
  • BTW, the command palette is Ctrl+Shift+P. Commented May 1, 2015 at 4:57
  • 1
    Looks like version 1.2.0 and above will have an integrated console. See: code.visualstudio.com/updates#_workbench Commented Jun 8, 2016 at 5:17
  • Somewhat related note: I was having trouble opening the native console (workbench.action.terminal.openNativeConsole in Keyboard Shortcuts, Open New Terminal in Command Palette), and I found out it was because I needed to first open a folder in vscode. The new console is opened with the current working directory set to the workspace directory in vscode, so I imagine that's why it wouldn't open without choosing a folder first.
    – spenceryue
    Commented Aug 21, 2019 at 2:45
  • 1
    It's actually a lot easier than that. Just go to Terminal > New Terminal on main navigation bar. On the right hand side, between + and trashcan button, select drop down to choose between Bash, PowerShell, CommandPrompt (cmd.exe), basically it'll automatically display any of the shells you have actually installed on your system. Commented Jul 12, 2022 at 18:53
  • try this: ctrl + j to show the opened terminal.
    – Karma
    Commented Feb 3 at 12:45

19 Answers 19

95

For integrated terminal use Ctrl+`

From the release notes:

With the May release, we are rolling out the initial version of an integrated terminal. You can open the terminal using Ctrl+`, from the View | Toggle Integrated Terminal menu, or from the View > Toggle Integrated Terminal command in the Command Palette.

https://web.archive.org/web/20160616204248/http://code.visualstudio.com/updates/#_workbench (the 1.2.0 May release in 2016)

3
  • 10
    On windows UK keyboard back tick did not work for but ctrl and apostrophe worked for me.
    – manish
    Commented Sep 12, 2016 at 9:22
  • My version at work has an optionon the right click context menu to open the terminal, similar to "Open in Command Prompt", but my version at home doesn't have this option... I shall investigate Commented Feb 26, 2018 at 22:29
  • 2
    On AZERTY keyboards: 'ctrl + ù'
    – Jean Bob
    Commented Jun 3, 2022 at 17:11
55

Use CMD+Shift+C or CTRL+Shift+C but it will only open a new outside editor standard bash console.

I hope they will implement an integrated console.

7
  • 1
    I am not getting that hotkey to work on Windows yet. I will confirm on Mac. Commented May 1, 2015 at 18:33
  • I tried on another computer and CTRL+Shift+C worked just fine. Commented May 2, 2015 at 1:25
  • And I agree, I wish it was integrated, but that hotkey works great. Opened right up into the project folder I was using. Thanks again! Commented May 2, 2015 at 1:26
  • 1
    There's an "Open New Command Prompt (Ctrl+Shift+C)" entry in Command Palette but it doesn't do anything at all, not at least on Windows 10. Commented Mar 25, 2016 at 12:03
  • Working for me on Windows 7.
    – Igor
    Commented Apr 21, 2016 at 23:04
28

Can open it with this menu options: View > Integrated Terminal

Default keyboard shortcut for integrated terminal is Ctrl+`

In vscode you can use multiple integrated terminals.
If you want open another one use Ctrl+Shift+`

vscode keys shortcuts are rendered assuming a standard US keyboard layout. If you use a different keyboard layout, please read how can see the representation in your current keyboard. It's easy, open this menu options: File > Preferences > Keyboard Shortcuts and on the Default Keyboard Shortcut search the command workbench.action.terminal.toggleTerminal then point you mouse to info icon and can see the combination. For me is Ctrl+ñ because I'm using Spanish keyboard layout.

enter image description here

Also it's cool create an personal shortcuts to toggle into terminals. Open this menu options: File > Preferences > Keyboard Shortcuts and on the keybinding.json tab put this:

[
    {
        "key": "ctrl+pageup",
        "command": "workbench.action.terminal.focusNext",
        "when": "terminalFocus"
    },{
        "key": "ctrl+pagedown",
        "command": "workbench.action.terminal.focusPrevious",
        "when": "terminalFocus"
    }
]

Now when the cursor are focus on terminal, and have more than one terminal, you can navigate through every one with the combinations Ctrl+Page Down for previous terminal and Ctrl+Page Up for next terminal.

Tip: If you are focus on the editor, the same keyboard shortcuts can be used to navigate through tabs.

22

For mac Cmd + j
For win Ctrl + j

0
9

test with the Ctrl + J keys in ubuntu

1
  • This one works on Fedora 31 (LATAM/US layouts) as well while the ones suggested in the other answers don't.
    – Asta86
    Commented Mar 15, 2020 at 23:52
9

@brady321's answer is only for US keyboards:

Note: The following keys are rendered assuming a standard US keyboard layout.(https://code.visualstudio.com/Docs/customization/keybindings)

For instance, UK keyboards use Ctrl+':

You can find your shortcut in File > Preferences > Keyboard Shortcuts searching for workbench.action.terminal.toggleTerminal. If you're not using a US keyboard, it will show you the equivalent shortcut using your keyboard layout:

enter image description here

To check what the shortcut to open a native console looks like, try to find workbench.action.terminal.openNativeConsole in the shortcuts file.

More information about integrated terminal at: https://code.visualstudio.com/docs/editor/integrated-terminal

8

As MCBL wrote, there is no integrated console. You can vote for this feature here: UserVoice - Integrated terminal <-- dead link.

3rd party Edit

Uservoice is no longer used and the link above is dead. The feature request for an integrated terminal might be this one.

1
5

In the contrary you may also run a terminal inside your visual studio code tool by simply doing the following:

Go to " View > Integrated Terminal " or use the shortcut key " Ctrl + ' "

I believe this is available on later versions of visual studio code. I could do this on version 1.7.0-insider.

1
  • Solve my problems. It's the older version of Visual Studio code that case no action when use the shortcut key " Ctrl + ' ". After update to 1.6, it works. Commented Nov 2, 2016 at 3:06
4

Ctrl+ `

Integrated Terminal In Visual Studio Code, you can open an integrated terminal, initially starting at the root of your workspace. This can be very convenient as you don't have to switch windows or alter the state of an existing terminal to perform a quick command line task.

To open the terminal:

1
3

I am using vsCode 1.9.1. there are 2 ways as I know

  1. You can easily open it by hitting Ctrl + ` key.
  2. Go to View->Integrated Terminal like below image

terminal for vscode

1
  • Menu image is very useful when Ctrl-` is mapped to something else, like, say, Ditto. If Ctrl-` is mapped elsewhere, you might also try Ctrl-Shift-` which worked for me. But the image is the proverbial lifesaver -- I tend to scan high & low... & here for "terminal"... and passed over the danged "Integrated Terminal" each time. Thanks!
    – ruffin
    Commented May 14, 2018 at 13:34
2

Test this, This works for me

Ctrl + ñ

Ctrl + `

ctrl + j

1

On my UK MacBook, when I look in my keyboard shortcuts for VS Code (Code > Preferences > Keyboard Shortcuts), Toggle Integrated Terminal has the keybinding Crtl+`.

However, the shortcut works on Ctrl+§, which is the key on my MacBook that is the same place as the ` on a UK Windows keyboard.

You can take the text editor of the Microsoft, but you can't take the etc, etc.

1

Go to File > Preferences > Keyboard Shortcuts or use shortcut Ctrl+K Ctrl+S.

Type to search in keybindings : workbench.action.terminal.new.

Double click on Keybinding and add the shortcut you want (Super+T is unused in default config).

0

Since the Debug Console does not support programs that need to read input from the console, you can enable an external, native console by setting the attribute externalConsole to true in your launch configuration. lauch.json just write: "externalConsole" : true

0

I used custom shortcut. Add below keybind to the keybinds.json:

[
    {
        "key": "ctrl+,",
        "command": "workbench.action.terminal.toggleTerminal"
    }
]

To open keybinds.json

CTRL + SHIFT + P then type Keyboard and click to Open Keyboard Shortcuts

0

The best way to run command line programs is to use the terminal window provided inside VS Code. This way tou will not switch any apps. But to make switching between terminal and other windows I recommend the following :

  1. To open up a terminal - Ctrl + `
  2. To open up second terminal - when you are running a node script in the first terminal and it is blocked and you need to run second script at the same time - Ctrl + Shift + `
  3. To focus/switch back on terminal without reopening :
    1. Press F1 and then type keyboard shortcuts
    2. Find workbench.action.terminal.focus and set it to Ctrl + \ - this slash is usually located right next to your right Ctrl key. This makes switching between code and terminal very easy because Ctrl + ` and Ctrl + \ are invoked with your right hand and index finger.
0

Switch the Integrated Terminal to CMD

  1. Open the Integrated Terminal: Ctrl + `
  2. If a Bash terminal is opened while you want a Command Prompt (cmd), simply run the command: cmd, in the terminal to switch it to Command Prompt.

enter image description here

0

Also for MAC its Ctrl+Shift+.

I prefer you to change to a custom one.
Open up Command Palette by Command+Shift+P.

Type 'Keyboard Shortcuts...' - Select Preferences: Open Keyboard Shortcuts

enter image description here.
See Terminal: Create New Integrated Terminal option there. Double-tap it to change it to a custom one.

enter image description here. enter image description here

0

For me:

ctrl + shift + `

Seems to have done the trick with the default VSCode settings. If you hover your cursor over the +-button to add a new terminal, you can actually see what you need to press for the shortcut.

Not the answer you're looking for? Browse other questions tagged or ask your own question.