Skip to content

ManualRemote

Tunnels, transfers and clipboard

Forward ports from a devserver, upload and download files, and copy and paste across machines with cs.

What you can do

  • Open a server running on the devserver in the local machine's browser, with cs tunnel.
  • Pull a file or a directory off the devserver with cs download.
  • Push files from the local machine into any directory there with cs upload.
  • Copy output on the devserver and paste it into any app here, or the other way round.
  • Move text and images between two devservers through your clipboard.

These are cs commands: run them in a chan terminal, and they act through the window that shows it. On a devserver the terminal runs there while the window, its clipboard and its downloads are here.

Forward a port: cs tunnel

  1. Start the tunnel

    In a devserver terminal, run this and leave it running:

    $cs tunnel 8080
  2. Serve something

    In another pane on the devserver, serve the current directory with Python 3:

    $python -m http.server 8080 --bind 127.0.0.1 --directory .
  3. Open it here

    Open http://127.0.0.1:8080 in your desktop's browser. Ctrl+C in the tunnel pane closes the forward.

cs tunnelForwards
3000The local machine's 127.0.0.1:3000 to port 3000 on the devserver.
8080:3000127.0.0.1:8080 here to port 3000 there.
5901 8080:3000Two tunnels in one command. Ctrl+C closes both.
8000-8003Four tunnels, each to the same port there.
0:3000-3002Three tunnels. The local machine picks a free port for each, and the command prints them.
0.0.0.0:8080:3000Port 8080 on every interface here, with a warning: anyone on the local machine's network reaches port 3000 there.

It needs Chan Desktop showing the window, and a devserver terminal: a browser cannot listen on your machine, and a terminal of the local machine refuses. Through a gateway, only the devserver owner's Chan Desktop can open one.

Move files: cs upload and cs download

CommandWhat happens
cs download FILEThe file downloads to the local machine, through the browser's or Chan Desktop's download.
cs download DIRThe directory downloads as DIR.tar, built as it streams. . is the current directory.
cs upload DIRA file picker opens here, and the files you choose land in DIR on the devserver. A file path means its folder.

Paths are on the terminal's machine; the files come from, and land on, the machine viewing the window. Any path your user can reach works, in a workspace window or a standalone terminal. Progress and Cancel are in the Transfers panel, opened from Transfers in the status bar; a browser lists a download in its own downloads instead.

The file browser's Upload and Download do the same with the mouse: see File browser.

Share the clipboard: cs copy and cs paste

The clipboard is the one of the machine viewing the window, not of the machine running the shell. Copy on a devserver and paste into any app here; copy here and paste there; copy on one devserver and paste on another.

CommandWhat it does
cs copy < photo.jpgPuts stdin on the clipboard as text, HTML or an image. An image arrives as PNG.
git log --oneline -20 | cs copyCopies text, ready to paste into any app here.
printf '<b>bold</b>' | cs copy --htmlCopies rich text, with a plain-text fallback.
cs paste > shot.pngWrites the clipboard to stdout as raw bytes: an image if there is one, else text.
cs paste --text, --html, --imageTakes that one form, and fails if the clipboard does not hold it.

Copy and paste keys, and selecting text in a terminal, are on Terminal basics.

Details and limits
  • cs tunnel runs for the tunnels' whole life, and exits when Chan Desktop disconnects or the window closes.
  • A tunnel group is all or nothing: a port the local machine cannot bind fails the command and closes the others. With no listener after 10 seconds it exits 124.
  • A devserver holds at most 32 live tunnels across its terminals: server.tunnel.max_live in server.toml.
  • Tunnels carry TCP only. A standalone chan serve hosts none.
  • cs upload and cs download return once the window has the request. Progress and errors show in the window, not the terminal.
  • An upload never overwrites: a name that already exists in the destination is refused.
  • In a browser, the upload picker may need a click: Choose files appears in the window.
  • Dragging files from your desktop onto a devserver window's terminal or file browser transfers nothing; use cs upload.
  • cs copy and cs paste wait for the window. A browser may ask for permission, or show a paste card whose Paste button gives the click it needs. They give up after 30 seconds and exit 124.
  • Clipboard contents are capped at 32 MB.
  • Redirect cs paste rather than printing it to the terminal: clipboard text can carry escape sequences.

Next