DEV Community

Cover image for I built an SSH terminal for VS Code and Cursor where Ctrl+click downloads the file
DHLPTX00
DHLPTX00

Posted on

I built an SSH terminal for VS Code and Cursor where Ctrl+click downloads the file

I'm a solo developer, and this is a short write-up of a small, free, MIT-licensed extension I made: Easy SSH, an SSH terminal that lives inside VS Code and Cursor.

Easy SSH overview: saved connections, sign-in options, jump hosts, a real login shell, Ctrl+click or Cmd+click to download, and drop to upload

The itch

Most of my SSH sessions are not "develop on the server" sessions. They're "log in, look at something, grab a file, maybe upload a config" sessions. For that I wanted:

  • a list of my servers, including ones behind a bastion
  • a normal login shell, not a special file browser
  • a way to get a file off the box without switching to scp and retyping the path
  • nothing installed on the server, and no remote editor downloaded when I connect

What it does

Click the Easy SSH icon in the activity bar and you get a connection list in a terminal tab. Type / for commands (/new, /edit, /delete, /import, /folder, /quit), or press Enter on a connection.

The connection list

Connecting opens your login shell in your home directory. Aliases, vim, less, top and sudo work as they do over ssh. Then:

  • Download a file: Ctrl+click its name (Windows/Linux) or Cmd+click it (macOS). It goes to your Desktop, or to a folder you pick with /folder.
  • cd into a directory: Ctrl+click (Windows/Linux) or Cmd+click (macOS) its name.
  • Upload: drag a file or folder onto the terminal and it lands in the current remote directory.

Hovering a name underlines it and tells you what the click will do, and normal mouse selection still works for copying text.

Ctrl+click (Cmd+click on macOS) a file name to download it

You can sign in with a password, a private key, or an SSH agent. You can hop through one or more jump hosts, and /import reads ~/.ssh/config while keeping the ProxyJump chain.

A shell on staging-db, reached through a jump host

How it knows where you are

This was the fun part. When the shell starts, Easy SSH sends one line that adds a bash PROMPT_COMMAND (or zsh precmd) hook. The hook prints $PWD as an OSC 7 escape sequence before every prompt. The extension reads that, so it always knows the remote directory, and it doesn't install anything on the server to do it. File and directory names are exposed as VS Code terminal links, which is why it's Ctrl+click on Windows/Linux and Cmd+click on macOS, and why normal mouse selection still works.

When it can't know the directory, for example after sudo su, it doesn't guess. An upload asks whether to use the last known directory, your home directory, or a path you type. Uploads always run over SFTP as the user you logged in as, so Easy SSH shows you the sudo mv command to finish the job.

Limitations (being honest)

  • It targets Linux servers, and directory tracking works with bash and zsh.
  • A single drop is capped at 5000 files, and symlinks inside dropped folders are skipped.
  • It's version 0.1.3 and brand new.

Try it

Bug reports and "this broke on my server" stories are the most useful thing you could send me.

If it saves you time, there's a Buy Me a Coffee link. No pressure.

Disclosure: I used AI assistance for parts of the code and this write-up; I reviewed and tested everything myself.

Top comments (0)