Skip to content
/
Try

Edit files on a remote server without a GUI

Open a folder, quick open, type, multiple cursors, save.

The easiest way to edit files on a remote server without a GUI is to SSH in and run a terminal editor there: ssh you@server, then nano file, vim file, or any editor you installed. The editor runs on the server and draws in your terminal, so nothing extra is needed on your machine.

If you would rather use a local editor, you have three other options:

  • mount the remote folder with sshfs,
  • let Vim edit over scp://,
  • copy files back and forth with scp.
Section titled “Option 1: run an editor on the server (recommended)”
Terminal window
ssh you@server
nano /etc/nginx/nginx.conf # or vim, or micro, or skink

Pros: language servers, git and builds run where the code is. There is nothing to sync, and it works from any terminal, even a phone.

Cons: you use whatever editor is installed, or install your own.

Most servers have vi, and many have nano. To get more, install an editor into your home directory. For Skink:

Terminal window
curl -fsSL https://skink.cc/install.sh | sh
skink ~/app # file tree on the left, the project's files in tabs
skink src/main.rs:120 # open at line 120

Option 2: mount the remote folder with sshfs

Section titled “Option 2: mount the remote folder with sshfs”
Terminal window
mkdir -p ~/mnt/server
sshfs you@server:/srv/app ~/mnt/server
# edit with any local editor, then:
fusermount -u ~/mnt/server # Linux; on macOS: umount ~/mnt/server

Pros: your local editor and its config.

Cons: every file read goes over the network, so project-wide search, git and language servers get slow on large trees. Those tools also run against the mounted copy, not on the server. On macOS it needs macFUSE.

Vim’s netrw can open remote files directly:

Terminal window
vim scp://you@server//etc/hosts # two slashes: absolute path
vim scp://you@server/notes.txt # relative to your home directory

Saving writes the file back with scp. It is good for single files, but there is no project view and no remote tooling.

Terminal window
scp you@server:/srv/app/config.yml .
$EDITOR config.yml
scp config.yml you@server:/srv/app/config.yml

Simple and safe for one file, error-prone for more than that.

How do I edit a root-owned file on the server?

Section titled “How do I edit a root-owned file on the server?”

Use sudoedit. It copies the file, opens it in your EDITOR, and writes it back as root:

Terminal window
EDITOR=nano sudoedit /etc/ssh/sshd_config

In Skink you can also open the file as yourself and save. On “permission denied” Skink offers sudo: it runs sudo tee in a terminal tab, where sudo can ask for your password, and closes the tab once the file on disk matches.

How do I copy text from the remote editor to my laptop?

Section titled “How do I copy text from the remote editor to my laptop?”

With a terminal editor over SSH, the editor’s clipboard is the server’s, not yours. The fix is OSC 52: the editor sends the copied text as an escape sequence, and your terminal puts it on your local clipboard.

Skink does this on every copy by default. Neovim detects it; Vim, Micro and Helix need a setting or package. Full guide: copy and paste over SSH.

Network drops happen. Run your editor inside tmux on the server:

Terminal window
ssh you@server
tmux new -A -s work # attach if it exists, else create
skink ~/app

If the connection drops, SSH back in and run the same tmux command. Add set -g mouse on and set -g set-clipboard on to ~/.tmux.conf so the mouse and OSC 52 pass through.

If tmux or your terminal eats a Skink key, press Ctrl+E and type its command instead, for example findinfiles for project search. See typed commands.

  • One static binary (musl on Linux), installed without sudo, about 8 MB of RAM when idle.
  • Modeless editing with familiar keys: Ctrl+S save, Ctrl+Q quit, Ctrl+F find.
  • Mouse support through SSH and tmux.
  • LSP, tree-sitter colours, project search (Alt+S), git gutter and git panel, all running on the server.
  • Terminal tabs (F12) for logs, builds, systemctl or an AI agent next to the file.
  • Atomic saves (never half a file) and backups of unsaved edits, so after a crash or dropped connection Skink offers to recover them.

More: the best terminal editor for SSH, Skink vs VS Code Remote SSH, SSH and remote editing guide.