skip to content
Shannon Crabill

Automatically Open the Current Directory in VS Code From Terminal

/ 2 min read

Last year, I was blown away by some Terminal commands that I learned. My favorite one is open . to open a Finder window for whichever directory you are currently in.

At one point I had a similar command to instantly open a folder in VS Code (Visual Studio Code), but deleted it after I switched from VS Code to Atom. I’ve since switched back to VS Code and after begrudgingly dragging folders into VS Code to open them, I decided to figure out how to enable that command.

Luckily, it’s takes a few steps to activate.

  • With VS Code running, enter Command + Shift + P to open the Command Palette (or View > Command Palette from the menu bar)
  • A search bar will open up. Search for “Shell” or “Shell Command” and you should see one named Shell Command: install "code" command in PATH.
  • Select it and a confirmation Shell command "code" successfully installed in PATH. should pop up (for me the pop up appeared in the lower, righthand corner).
  • If you already have a Terminal session running, quit or restart it.
  • When you are in the directory of the files you want to open in VS Code, type code . (that is the word “code” followed by a space, then a period) and the folder will automatically open in VS code.