To open VS code from the command line you need to do the following:
-
Click 'View' -> `Command Palette'.
-
Type and find the
Shell Command: Install 'code' command in PATH
command. -
Restart your terminal.
Now you will be able to open files and folders from the command line.
Ways to open files / folders
Navigate through the command line to the folder you want and type and enter code .
to open VS code in that directory.
You can also write in the command line code path_to_folder
to open a specific directory. Or you can write code path_to_file
to open a specific file from the command line in VS Code.
Lastly, you can also just write code new_filename.html
to open a new file.