Visual Studio Code is a programming text editor. We will use its Remote Development Extension to work on the CS Linux machines remotely from your computer. Under the hood, the Remove Development Extension uses SSH, the Secure Shell. If you are not using VSCode, you can learn about using SSH directly here.

Contents

Install

Install VSCode

Follow the instructions for your operating system:

The main “Installation” section on each of these pages should be enough.

Privacy Note

By default, VSCode collects data about your usage of the application and sends it to Microsoft. You may wish to disable this “telemetry” reporting when you first launch VSCode.

Install the Remote Development Extension

  1. Start VSCode. It will automatically open some documentation windows.
  2. Click the extensions icon on the left hand side.

    Extensions icon

  3. Search for "remote development"
  4. Click on "Remote Development". That will put info about that extension in the main window.

    Remote Development Extension summary screenshot

  5. Click on the "Install" button under the Remote Development title.

Connect to the CS Linux Machines with SSH

After the installation steps above, and after launching the VSCode application, you can use it to edit remote files:

  1. In the lower left of the VSCode window, you'll see a green icon that looks like this:

    VSCode remote icon

  2. Click on the green icon (hover says: "open a remote window"). At the top of VSCode, you'll see a menu like this:

    VSCode remote menu

  3. Choose "Remote-SSH: Connect to Host" and connect to youraccount@cs.wellesley.edu. (Replace youraccount with your CS username.) Looks like this:

    VSCode remote login

  4. If prompted about a "fingerprint" for cs.wellesley.edu, continue.
  5. Enter your CS (not Wellesley!) password when prompted.
  6. If you succeed, VSCode will show some progress status in the bottom of the window and eventually the lower left of the VSCode window will show the remote connection, like this:

    VSCode remote session

Find and Edit Files on the CS Linux Machine

Editing files on the remote machine is pretty straightforward:

  1. Click on the Explorer Icon (or command-shift-e)
  2. Choose "Open Folder" under connected SSH
  3. Choose a folder on your remote machine, such as public_html
  4. Open or create a file, such as hello.txt. Edit it. Save it.

As an alternative to the graphical user interface for opening files, you can also use the code command in a terminal to open a file. See below.

Remember, you are working on a remote machine through VSCode, so you will not see these remote files if you look around on your local computer through other applications.

Run Commands on the CS Linux Machine

To run commands on the remote machine through VSCode, open a terminal from within VSCode:

  • From the Terminal menu in VSCode, choose “New Terminal”. This opens a terminal on the remove machine (cs.wellesley.edu) over SSH.
  • Run any commands in the terminal.
  • For example, if you are working in your home directory and you want to open a file called my-file.txt, you could use the command code my-file.txt. That will open the file my-file.txt for editing in VSCode.
  • See more about command line tools in Assignment Zero or on the tools reference page.

Exit

  • logout from your terminal window, and
  • click on the remote session icon and choose "Close remote connection"
  • quit VSCode

License

This page is adapted from Scott Anderson’s similar page for CS 304. © Scott D. Anderson. This work is licensed under a Creative Commons License.

Creative Commons License