11

I know I can use command "code" to open VS code or file, but I don't know what should I do to make it possible after I install VS code in Ubuntu.Thanks.

1
  • Have you tried to navigate to the project folder using Terminal and then typing code . ? Commented Nov 16, 2016 at 16:28

2 Answers 2

20

Launching from the Command Line You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. We find the best way to do this is to simply type:

code .

Tip: We have instructions for Mac users in our Setup topic that enable you to start VS Code from within a terminal. We add the VS Code executable to the PATH environment variable on Windows and Linux automatically during installation. Sometimes you will want to open or create a file. If the specified files does not exist, VS Code will create them for you:

code index.html style.css readme.md

Tip: You can have as many file names as you want separated by spaces.

Source: https://code.visualstudio.com/Docs/editor/codebasics

Sign up to request clarification or add additional context in comments.

2 Comments

Worked for me, open terminal cd /project/root/dir and type code . and got complete file open in VS Code.
Nice! And, the program does not stay running in the terminal, so you can do other things in the terminal or close it without closing VS Code.
-1

So, there are a couple of solutions for this. I've linked a video that shows you how to add vscode to $PATH (which didn't work for me because I couldn't find the "shell:install path" command)

I uninstalled the vscode from my ubuntu and re-installed using sudo snap install --classic code (This method worked for me)

Tell me which one works for you... and if you have extensions installed to your vscode then i guess you ought to make a backup or something.

Link to the video: https://youtu.be/iP5FKZXtDBs

1 Comment

While the video might be useful, it's better to have a summary of the solution here (this applies to links in answers on SO as well), in the case of link rot, and in the case of videos, accessibility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.