The quickest way to open VS Code from terminal is to type code . in any folder, then press Enter

When you have VS Code installed, the code command becomes available in your terminal. Typing code . opens VS Code in the current folder you are in — the period means "this folder right here". This is faster than clicking through your file system or opening the process first and then navigating to your project.

The setup takes one minute. On Windows, the installer adds the command automatically. On Mac and Linux, you may need to add it yourself by opening the Command Palette in VS Code (press Ctrl+Shift+P on Windows or Linux, Cmd+Shift+P on Mac), typing "shell command", and selecting "Install 'code' command in PATH". After that, the command works in any terminal window.

Key Takeaways

  • Type code . in your terminal to open VS Code in the current folder, where the period represents the folder you are already in.
  • On Windows, the code command is ready to use after installation; on Mac and Linux, you must run the "Install 'code' command in PATH" option from the Command Palette first.
  • You can open a specific file by typing code filename.txt instead of a period, or open multiple files by listing them separated by spaces.
  • If the code command does not work after installation, restart your terminal window so it picks up the new command.

How to set up the code command on Mac and Linux

Windows users can skip this section — your installer already added the command. Mac and Linux users need to tell your system where the code command lives.

Open VS Code. Press Cmd+Shift+P on Mac or Ctrl+Shift+P on Linux to open the Command Palette. Type "shell command" and you will see "Shell Command: Install 'code' command in PATH" appear. Click it or press Enter. VS Code will ask for permission to modify your system PATH — this is the list of locations your terminal searches for commands. Approve it. Close and reopen your terminal window, and the code command will now work.

Opening a specific file instead of a folder

If you want to open one file rather than an entire folder, type code filename.txt, replacing "filename.txt" with the actual name of your file. This opens just that file in VS Code without loading the whole folder structure.

You can also open multiple files at once by listing them with spaces between: code file1.js file2.js file3.js. Each file opens in its own tab. This is useful when you are jumping between related files and want them all ready to edit.

What to do if the code command does not work

The most common reason the command fails is that your terminal has not reloaded the PATH yet. Close your terminal window completely and open a new one. This forces your system to reload the list of available commands.

If it still does not work on Mac or Linux, open VS Code again and run the "Install 'code' command in PATH" option from the Command Palette a second time. On Windows, try uninstalling and reinstalling VS Code — make sure you check the box that says "Add to PATH" during installation.

You can test whether the command is installed by typing which code on Mac or Linux, or where code on Windows. If the command exists, you will see the path to the VS Code executable. If you see nothing, the command is not yet in your PATH.

Opening VS Code in a new window versus the current window

By default, code . opens your folder in the current VS Code window. If you already have VS Code open with another project, this switches you to the new folder.

To open the folder in a separate VS Code window instead, type code -n . (the -n flag means "new window"). This is useful when you want to work on two projects side by side without switching between them.

Using the terminal inside VS Code itself

Once you have VS Code open, you can open a terminal within the process itself without leaving the editor. Press Ctrl+` (backtick, the key above Tab) on Windows or Linux, or Cmd+` on Mac. A terminal panel appears at the bottom of your screen, already positioned in your project folder.

This built-in terminal is the same as your system terminal — you can run commands, install packages, or commit code without switching windows. Many developers find this faster than flipping between VS Code and a separate terminal process.

Frequently Asked Questions

Can I open VS Code from terminal if I installed it from the Microsoft Store on Windows?

Yes, but the setup is different. The Microsoft Store version does not add the code command automatically. Open VS Code, press Ctrl+Shift+P, type "shell command", and select the install option. This adds the command even for the Store version.

What does the period mean in "code ."?

The period is shorthand for "the current folder". In any terminal, a single period represents the folder you are already in. So code . means "open VS Code in this folder". You could also type the full path: code /Users/yourname/Projects/myfolder would open that specific folder instead.

Can I open a folder that is not my current folder?

Yes. Instead of a period, type the path to the folder: code /path/to/your/folder on Mac or Linux, or code C:\Users\YourName\Documents\myfolder on Windows. VS Code opens that folder even if you are in a different location in the terminal.

What if I want to open VS Code but not load any folder?

Type code with nothing after it. This opens VS Code with no folder loaded, so you see the Welcome tab. You can then open a folder later using File > Open Folder in the menu.

Does the code command work in PowerShell on Windows?

Yes, the code command works in PowerShell, Command Prompt, and Windows Terminal. The installer adds it to your system PATH, so it is available in any terminal process you use.