How to Open VS Code from the Terminal/Command Line

Learn how to quickly open your projects inside Visual Studio Code via the command line.

After following this tutorial you can open your projects in VSCode via your terminal like this:

How to do it

To open Visual Studio Code from your command line, you need to make sure that you have the VS Code command line tools installed.

On Windows, this should work out of the box.

On Mac, open up VS Code, go to View -> Command Palette and search for this:

Shell Command: Install 'code' command in PATH

Just type “shell” and it should pop up automatically.

Shows VS Code’s View -> Command Palette dropdown list

Now click on it and it will install in a matter of seconds.

Now restart VS Code, and the next time you want to open any project from your command line, open your terminal and do the following:

  • cd into your project directory
  • Type code . and hit Enter.

Now your VSCode will launch an instance running your project.

Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊


Share & Discuss on