Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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 Answers 2

up vote 2 down vote accepted

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
share|improve this answer
    
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

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 seperate 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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