Search code examples
command-lineterminalvisual-studio-codetext-editor

How to call VS Code Editor from terminal / command line


The question says it all.

How can I open VS Code editor from

  • windows cmd
  • linux and mac terminal

e.g. for notepad++ I write

> start notepad++ test.txt

By the way, the editor is awesome (cross-platform)! Thank you Nadella!

You can download it from microsoft


Solution

  • To open a file or directory use the command:

    code /path/to/file/or/directory/you/want/to/open
    

    For macOS users, it needs to be installed manually:

    1. Launch VS Code.
    2. Command + Shift + P to open the Command Palette.
    3. Type shell command, to find the Shell Command: Install 'code' command in PATH and select to install it.
    4. Restart your terminal.