2

There are numerous tools for using numerous terminal prompts from a single window, like gnu screen---but I'm wondering about the opposite. I'd like to access the same prompt from different windows. In particular, I'm using NoMachine to run a virtual desktop where there is a particular tty I'd like to access from a normal SSH session. Is there a way to attach to the same tty session from the SSH session?

DilithiumMatrix
  • 549
  • 1
  • 4
  • 15

1 Answers1

2

You can use either screen or tmux to attach to the same (remote) tty from multiple other source (client) locations.

But you might be asking how to make either screen or tmux gain control of an existing tty. I don't know how to do that, but you could re-parent an existing process (perhaps even a shell) to a tty that is owned by screen or tmux using reptyr. See one of multiple references on use of reptyr: here orhere. Others exist, I'm sure.

crimson-egret
  • 3,276
  • 17
  • 20
  • Kind of wondering if screen would interfere with any VI(M) shortcuts, but probably not on a basic setup – polynomial_donut Jun 11 '19 at 19:55
  • Generally not, except where the `screen` shortcuts overlap with any VIM key-sequences. By default, `screen` uses the prefix-key `Ctrl-a` to enter the screen command system, which messes up some things that use emacs-style key-bindings. I have in my `.screenrc` a line to change the prefix to `Ctrl-j` --- `escape ^Jj` – crimson-egret Jun 12 '19 at 19:14