Published 2026-11-27.
Time to read: 1 minutes.
posts collection, categorized under Visual Studio Code.
$ code \
--new-window \
--folder-uri "vscode-remote://ssh-remote+mslinn@bear/mnt/f/work/ruby/my_gems/live_source"
I defined an alias called live_source that opens the
live_source project on computer Bear:
alias live_source='code --new-window --folder-uri "vscode-remote://ssh-remote+mslinn@bear/mnt/f/work/ruby/my_gems/live_source"' alias msp='code --new-window --folder-uri "vscode-remote://ssh-remote+mslinn@bear/var/sitesUbuntu/www.mslinn.com"'
To launch Visual Studio Code and open a remote project folder or file over SSH,
pass a vscode-remote:// URI to the code CLI with --folder-uri (or
--file-uri):
# Open a remote folder using an SSH config host alias or user@host
code --folder-uri "vscode-remote://ssh-remote+my-server/home/user/projects/my-app"
# Open a specific remote file
code --file-uri "vscode-remote://ssh-remote+my-server/home/user/projects/my-app/README.md"
# Open in a new window instead of reusing the current one
code --new-window --folder-uri "vscode-remote://ssh-remote+user@192.168.1.50/var/www/app"
Common Variations & Tips
-
Host format: Replace
my-serverwith aHostalias defined in~/.ssh/configor withuser@hostname(oruser@ip-address). If using a non-default SSH port defined in~/.ssh/config, the alias automatically picks it up. -
Percent-encoding special characters: If your host or path contains spaces or special characters (such as
@,#, or%), percent-encode them in the URI (for example,%20for spaces). -
Prerequisites: The Remote - SSH extension (
ms-vscode-remote.remote-ssh) must be installed in VS Code, and thecodecommand must be in your localPATH(on macOS, run Shell Command: Install ‘code’ command in PATH from the Command Palette if needed). -
From inside an existing SSH shell: You can also SSH into the machine first and run
code /path/to/project—VS Code will open a local window connected back to that remote path if SSH forwarding/integration is active, thoughcode --folder-uri "vscode-remote://ssh-remote+..."from your local terminal is the most direct way to launch it on demand.