Launching from the command line# You can also run VS Code from the terminal by typing 'code' after adding it to the path: Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
To get an overview of the VS Code command-line interface, open a terminal or command prompt and type code --help . You will see the version, usage example, and list of command line options.
To open a file or directory use the command:
code /path/to/file/or/directory/you/want/to/open
For macOS users, it needs to be installed manually:
Command + Shift + P
to open the Command Palette.shell command
, to find the Shell Command: Install 'code' command in PATH
and select to install it.Per the docs:
Mac OS X
- Download Visual Studio Code for Mac OS X.
- Double-click on VSCode-osx.zip to expand the contents.
- Drag Visual Studio Code.app to the Applications folder, making it available in the Launchpad.
- Add VS Code to your Dock by right-clicking on the icon and choosing Options, Keep in Dock.
Tip: If you want to run VS Code from the terminal, append the following to your ~/.bash_profile file (~/.zshrc in case you use zsh).
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
Now, you can simply type code . in any folder to start editing files in that folder.
Tip: You can also add it to VS Code Insiders build by changing "com.microsoft.VSCodeInsiders". Also if you don't to type the whole word code, just change it to c.
Linux
- Download Visual Studio Code for Linux.
- Make a new folder and extract VSCode-linux-x64.zip inside that folder.
- Double click on Code to run Visual Studio Code.
Tip: If you want to run VS Code from the terminal, create the following link substituting /path/to/vscode/Code with the absolute path to the Code executable
sudo ln -s /path/to/vscode/Code /usr/local/bin/code
Now, you can simply type code . in any folder to start editing files in that folder.
VS Code is a must have code editor for 2018
For Windows 10 users a lot is possible, the same way the Mac OS users type code .
.
Look for you VS Code \bin folder path e.g C:\Program Files\Microsoft VS Code\bin
. The bin folder includes a file called code.cmd
Follow the steps below and be proud of the OS you use.
Search for "Advanced System Setting" from Start.
Click on Environment Variables
On System Variables choose "path" from Variable tab and click on Edit.
Click on New on the right side of the popup window.
Copy your path from the Explorer's breadcrumb path and paste it into the new opened path in step 4, example:- C:\Program Files\Microsoft VS Code\bin
Click Ok on all the open windows to confirm changes and restart your cmd
Go to your cmd
and navigate to you working directory on server and type code .
C:>cd wamp64\www\react-app> code .
to open with VS Code on Windows.
Visual Studio Code also includes a command prompt (terminal) window and you can open one or more of them with Ctrl + `
on your keyboard.
Hope this helps some one like it did to many of us.
You can also run VS Code from the terminal by typing code
after adding it to the path:
Launch VS Code.
Open the Command Palette (⇧⌘P)
and type shell command
to find the Shell Command: Install code
command in PATH command.
Mac shell commands
Restart the terminal for the new $PATH
value to take effect. You'll be able to type code .
in any folder to start editing files in that folder.
Add the directory "C:\Program Files (x86)\Microsoft VS Code Insiders\bin"
at %PATH% environmental variable.
then go to the folder that you want to open with vs code and type:
code-insders .
Sometimes setting path from VS Code command palette does not work
Instead manually add your VS Code to your path:
Run in terminal
sudo nano /etc/paths
Go to the bottom of the file, and enter the path you wish to add
Hit control-x to quit. Enter “Y” to save the modified buffer.
Restart your terminal and to test echo $PATH
. You should something similar
~ echo $PATH /Users/shashank/.nvm/versions/node/v8.9.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
Next time, you navigate to your project folder from terminal
code .
code /path/to/project
Source
In the case of Linux and Mac, you want to navigate to the directory that you extracted the VSCode files using the 'cd' command. For example:
cd ~/Downloads/VSCode
Then you start the application by running..
./Code
'Code' being the name of the executable.
If you have root access on the machine, you can configure the system to allow you to start VSCode from anywhere by linking it to /usr/bin, where links to executables are often stored.
sudo ln -s /path/to/VSCode/folder/Code /usr/bin/Code
You can now launch VSCode from anywhere by typing:
Code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With