So I'm new to screen and I've been using this .screenrc for now - https://gitlab.com/joaopizani/env.screenrc-ftw.

I'm trying to make a script that, given a target host, will do the following:

  1. Open a screen, ssh to the target host
  2. Open another screen, ssh to the target host, run htop
  3. Attach both screens together for a split view

I've been able to do the first 2 by using ssh-keygen and ssh-copy-id, followed by (assuming HOST is a given argument):

  1. ssh -dmS "terminal_HOST" ssh HOST
  2. ssh -dmS "htop_HOST" ssh -t HOST htop

I'm not able to attach the htop to the terminal (I don't mind doing the split with my predefined key-combo...)

Is this even possible?

  • This would arguably be easier to do from tmux. Would you care for a tmux solution, or is that not interesting? – Kusalananda Sep 6 '17 at 13:12
  • Id rather stick with screen due to it's widespread distribution :) – hyit Sep 6 '17 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.