How to Open Visual Studio Code Using Terminal
Did you know you can launch Visual Studio Code directly from your terminal? It's quick, efficient, and makes coding workflows much smoother. In this guide, we'll show you how to set it up on both Windows and macOS.
How to Open VS Code From Terminal?
To open VS Code, you need to make sure VS Code is in your system's PATH. For that, open VS Code and configure a few VS Code settings.
Steps to Add VS Code to Your System PATH"
- Open VS Code.
- Press
Ctrl
+Shift
+P
or Cmd + Shift + P (on macOS) to open the Command Palette. - Type "Shell" and select "Shell Command: Install 'code' command in PATH." and hit Enter
Done! You can now launch VS Code directly from your terminal using the code command.
Note: If you don't have VS code, install VS code for your Windows, Mac or Ubuntu operating system.
Steps to Open Visual Studio Code From Terminal
Step 1: Open the Terminal
- Windows: Search for "Command Prompt" or "PowerShell"
- macOS: Press cmd + Space, type " Terminal", and hit Enter
- Ubuntu/Linux: Press Ctrl + Alt + T
Step 2: Use the following commands to open VS Code.
Command 1: To open VS code in the current directory.
Code
Command 2: To open a specific file or folder in VS code.
code [path to file]
Command 3: To start a new project in VS code
code -n
For more such commands, get help using the following command. It displays VS Code command-line options and descriptions.
code --help
And That's it, Now you know how to open Visual Studio Code directly from the terminal whether it's a current directory, a specific file, or a new project on windows, macOS, or Linux.
Visual Studio Code is a streamlined code editor with support for development operations like debugging, task running, and version control. Starting VS code from the terminal allows developers to run commands quickly and efficiently, making coding faster and more convenient.
Hence, we have successfully accessed VS code using terminal in Windows or MacOS.
Also Read
Conclusion
Accessing Visual Studio Code (VS Code) from the terminal is a simple yet powerful skill for any developer. Whether you're working on Windows, macOS, or Linux, starting VS Code from the terminal can speed up your workflow and make project management easier. Just make sure the code command is installed, and you're good to go!