DEV Community

Cover image for Open Visual Studio Code from the Terminal
Leonardo Montini for This is Learning

Posted on • Updated on • Originally published at leonardomontini.dev

Open Visual Studio Code from the Terminal

Ok, it's not a super secret feature, but I noticed some of my colleagues and friends do not use it at all while I think it's quite handy, so I'm sharing it here.

You might already know, but you can launch vscode from the terminal by just typing code

code . will Open vscode on the current location, also cool if you're wandering around your filesystem in the terminal for whatever reason.

It can also accept a parameter that is the path, so with code your/path it will open a vscode instance already pointing to that file or folder. This is particularly handy right after git clone as all you have to do is code repo-name and you're ready to write some code.

Last but for sure not least, I made a short video as usual about the topic, you can find it here:

Watch the video


So, a question for you, how often do you open vscode from the terminal?


Thanks for reading this post, I hope you found it interesting!

Do you like my content? You might consider subscribing to my YouTube channel!
You can find it here:
YouTube

Feel free to follow me to get notified when new articles are out ;)

Latest comments (8)

Collapse
 
pbnj profile image
Peter Benjamin (they/them) • Edited

So, a question for you, how often do you open vscode from the terminal?

Not as much since I started using Project Manager vscode extension.

When I use VS Code (10-20% of the time), I hit a keyboard shortcut to launch VS Code, then hit another keyboard shortcut to launch Project Manager, fuzzy search any project on my system, and hit enter to open in new vscode instance.

As a terminal user predominantly, I have the same workflow using tmux + fzf: shortcut to launch the terminal, then shortcut to launch fzf to fuzzy search any project on my system, and hit enter to open in a split tmux pane or new tmux window.

Collapse
 
balastrong profile image
Leonardo Montini

That's smart! Thank you for sharing ❤️

Collapse
 
polterguy profile image
Thomas Hansen

I always open VS code from the terminal since I saw Anders Hejlsberg doing it in one of his sessions. I'm on a Mac though, so it probably makes more sense for me 😊

Collapse
 
balastrong profile image
Leonardo Montini

That's true, on Windows I almost always opened it from the UI, on mac I'm going from terminal, not sure why 😅

Collapse
 
thomasbnt profile image
Thomas Bnt ☕
code ~/
Enter fullscreen mode Exit fullscreen mode

😎🔥
don't do that

Collapse
 
azlan_syed profile image
Azlan-Syed

i use powershell and write code . and vscode opens and in linux it is just code probably i do use code from terminals alot

Collapse
 
balastrong profile image
Leonardo Montini

As written in the article, to me I find it really useful to launch vscode from the terminal right after cloing a repo.

I'm also recently starting to open repos from my large side-projects folder as from the terminal I feel I can easily find them with autocomplete. Not sure why, but feels smoother 😅

Collapse
 
acode123 profile image
acode123

thanks for the tip!