Search code examples
linuxgnu-screen

opening all detached screen sessions in one command on linux


is there a way to open/attach to all detached screen sessions on linux in one command/script? typically I have the following flow to open a session:

#see all screen sessions
screen -rD 
#attach to one screen session
screen -rD screen_name

Solution

  • It would be easier to have only one screen session with many terminals within. You create a new terminal with Ctrl+a+c, then you switch through them with Ctrl+a+<space> or <backspace> or a number. I don't think there is an easier way if you do that manually. If you spawn sessions with a script, you may try using -X to make screen open a new window in an existing session and execute commands in there. Perhaps this answer is close to what you would need. You will need to make sure you name your screen session in a way, you can reference it later unambiguously.