'How to open a shell command prompt inside Visual Studio Code?

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.



Solution 1:[1]

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.

Solution 2:[2]

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.

Solution 3:[3]

@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

Solution 4:[4]

test with the Ctrl + J keys in ubuntu

Solution 5:[5]

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.

Solution 6:[6]

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.

Solution 7:[7]

For mac Cmd + j
For win Ctrl + j

Solution 8:[8]

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:

Solution 9:[9]

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

Solution 10:[10]

Test this, This works for me

Ctrl + ñ

Ctrl + `

ctrl + j

Solution 11:[11]

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.

Solution 12:[12]

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).

Solution 13:[13]

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

Solution 14:[14]

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

Solution 15:[15]

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.

Solution 16:[16]

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

Solution 17:[17]

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