Launching VS Code from the Command Line

Let's take a look at the following steps:

  1. You can also run Visual Studio Code from the Terminal by typing code after adding it to the PATH environmental variable:
  2. Launch Visual Studio Code
  3. Open the Command palette by pressing ShiftcmdP 
  4. Type shell command to find the Shell Command: Install 'code' command in PATH command
  5. Press Enter and Visual Studio Code will be added to the PATH
  1. Restart the terminal for the new $PATH value to take effect
  2. You'll be able to type code in any folder to start editing files in that folder
If you had earlier versions of Visual Studio Code and have added Visual Studio Code as an alias in your .bash_profile or equivalent for other shells, then remove that reference from the file and replace that by following the above steps to run  Shell Command: Install code command in PATH   command.