3

The following command screen -t 'fubar' cmd will create a new screen window with the command cmd running in it and will set the focus to this window.

How can I keep the focus in the current screen window, not the new one?

  • I do not know how to solve your precise problem, but you can try to create a new detached screen in your screen with something like: screen -t 'fubar' -d -m cmd – lcipriani Apr 20 '12 at 10:33
2

I'm not sure that you can do it in one go, here is a workaround:

screen -t 'fubar' cmd & sleep .01; screen -X other
  • screen -X other does indeed return me to the first screen which is what I wanted. Nice workaround. – Sardathrion Apr 20 '12 at 13:29
3

Inside a current screen session, this will start your command in a new screen window and then immediately switch back to your previous screen window, effectively backgrounding the new screen window.

Enter the screen command line with Ctrl-a : and enter

eval 'screen top' 'other'

eval parses and executes each argument as a separate command. So the first command is to run top in a new screen window and the second command is toggle to the window displayed previously.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.