Remote Commands with vscode ssh

One thing I found myself missing from VS-Code was the ability to run SSH commands from within the editor. I know this works on Windows, but since I primarily use MacOS and Linux, this means that I would always have to open a terminal, switch to my project directory and then run the commands.

But not anymore! This week VS-Code released version 0.12 of their Remote Development Extension Pack. This pack allows you to connect to a remote machine via SSH and open a VS-Code instance on that machine in your local window. You can read more about it here.

Remote Commands with vscode ssh

The extension comes with three different extensions:

SSH FS: This extension allows you to connect to a remote machine via SSH, and exposes the remote file system via localhost.

SSH: This extension allows you to access the command line of your remote computer via localhost. For example, if your machine runs Ubuntu, you will be able to run apt-get commands as if you were directly on your remote machine!

Remote WSL: A similar extension for Windows Subsystem for Linux.

I installed these extensions and tried them out on one of my servers running Ubuntu 16 LTS at home and it worked perfectly!

Did you know that you can perform SSH commands from VS-Code? It’s pretty awesome, and it makes me wonder how I was able to connect to servers without it.

What do you need?


An SSH key in your .ssh folder (Mac) or the Windows 10 OpenSSH Client & OpenSSH Server

A couple of extensions for VS-Code: Remote Development and Remote – SSH

If you have all of those things, then you’re ready to open a new remote terminal by pressing Cmd + Shift + P and typing “Remote-SSH” in the search bar. Then, select the “Remote-SSH: Connect to Host…” option. If this is your first time connecting to a server, it will ask you to add a hostname. The hostname is your server’s IP address or domain name (in my case, I’m using my Digital Ocean droplet).

After that, it will prompt you for your password and ask if you want this connection to be saved. If all goes well, you’ll see something like what’s shown below!

In my day-to-day work, I frequently need to SSH into other machines. Usually, I use the venerable terminal app, but sometimes it is nice to be able to do this from within VS-Code.

VS-Code has a great extension called Remote Development that allows you to edit code on remote hosts and virtual machines through SSH.

I recently started using it and have found it really useful. This article will look at how you can use it.

First up, you will need to install the Remote Development extensions. Search in VS-Code for ‘remote development’ and install them all. The main one is called Remote – SSH by Microsoft, which provides the core functionality:

Visual Studio Code has a host of extensions that make development easier. One of my favorite extensions is the SSH FS, which allows me to SSH into my server and edit files directly in VS Code. That’s pretty cool and all, but there are times where I need to run commands on the server.

I know there is an extension for that already: Remote-SSH. But it requires you to open up a separate window and type everything out in a terminal. The editor just becomes more of a distraction at this point.

What if there was a way to run terminal commands from within VS Code? Well, I decided to try to figure it out:

The extension I created is called vscode ssh. It is inspired by the excellent CRT extension for Visual Studio (which sadly doesn’t seem to be updated anymore). To get started, simply install the extension from the marketplace and reload your editor window (if necessary).

Next up, make sure you have a remote connection set up in your settings file. You can see how to do this in the README over on Github.

Once you have done that, select “Remote SSH: Run Command” from the command palette (CTRL+SHIFT+P) and pick a command from the list

It’s no secret I’m a huge fan of VS-Code, even though it is not quite as simple to configure as Sublime Text. One of the best things about VS-Code is the plethora of extensions and addons that you can install to extend its functionality.

In this blog post we will explore a few extensions that are worth installing for anyone who works with remote servers or hosts their own website and wants a powerful IDE to work with.

For this blog post we’ll be using a fresh install of Ubuntu 18.04 LTS (I used Digital Ocean), but you can use pretty much any Linux distro available. You can see our official supported Operating Systems here.

Now, I have never been a fan of using the terminal in vscode. I always found it to be slow and buggy, but this new extension has changed my mind. In fact, I didn’t even know that there was this kind of support for SSH built into vscode.

The first thing you need to do is install the extension:

Once it’s installed and you reopen the editor, you’ll see a new section on the bottom left of your screen: “SSH Targets” (you may need to click the > icon to expand). If you don’t see it, you can use F1 > Remote Explorer to open it.

So what you do is click on “Open Configuration File…”, and now a text file will open up with a list of SSH targets that you can connect too.(

I have been using Visual Studio Code for a while and I use it mostly with Python and C

Leave a Reply

Your email address will not be published.