commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
move current window to the specific window id in GNU screen
"-D -R Attach here and now. In detail this means: If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user. This is the author?s favorite."
-RR option is used to resume the first appropriate detached screen session
I alias this as "tach":
alias tach='screen -x `screen -ls | grep Detached | cut -c -10`'
If you have several detached sessions it will just grab the first one. If you're running nested screens you can open new outer windows and run tach repeatedly to grab all the detached sessions into that one.