Remix.run Logo
jasongill 7 hours ago

While in an SSH session, press enter, then type tilde and capital C (enter ~C) and you can add command line options to the current session. To add a port forward from your local 8080 to the remote port 80 without closing the connection, do:

  enter ~C -L 8080:localhost:80
Tepix 5 hours ago | parent | next [-]

Thanks. This could really benefit from a TUI!

zimpenfish 7 hours ago | parent | prev | next [-]

That is a neat trick. Added to the list.

(Ultimately unhelpful though because I use mosh everywhere these days and that doesn't appear to have anything fancy like this.)

dylan604 6 hours ago | parent | prev [-]

Maybe it's just still too early in the morning yet, but what is the significance of hitting enter first?

jasongill 6 hours ago | parent [-]

SSH expects the escape sequence (tilde) to be the first character on a new line; since backspace is sent as a character, you can't just backspace over something you've started typing and then press tilde to have it recognized.

Technically, you don't have to press enter if you've not typed anything (try it in a new SSH session - as soon as you are logged in, type ~? to get the SSH help output), but since the comment was about doing this during an active session without ending it, I figured noting that pressing enter first to be sure you're on a new line wouldn't hurt