gnu screen tips
How can I reattach/reconnect to a GNU screen session?
screen -R -D
How can I hook up the Ctrl+a to something different (say Ctrl+j)?
Add this line to your ~/.screenrc file:
How can I, at a given point, say, move window 5 to window 1, so that I
have the history in 5 now in 1, next to 0?
Ctrl+j 5 Ctrl+j :number 1 <return>
info -f screen -n Number
I've got more than 9 screen windows, how can I move to say window 11?
Using ctrl-a ' to get a prompt, typing your window number, hitting enter.
6. Managing DISPLAYs. The disconnect-and-resume-anytime way of working can sometimes be a curse. Shells inside screen windows don't get environment variables like $DISPLAY updated whenever you resume a session. So if you carelessly launch an X program from inside one, it may end up on a display which is either long gone or not the one you intended to use. The following simple trick automagically sets DISPLAY to the display at the last place you resumed a screen session (i.e. probably where you are sitting right now).
First, write the value of $DISPLAY to a file whenever you resume screen. One way to do this is by using a shell alias like the following whenever you resume, instead of using screen -d -r directly:
alias sc='echo $DISPLAY>~/.last-display; screen -d -r'
Alternatively, the invocation from #3, above, might now look like this:
ssh -X -t ulysses "echo \$DISPLAY>~/.last-display; screen -d -r"
Now, this shell alias here sets the display appropriately, so that, for example, here xterm runs xterm on your "current" display:
alias here='DISPLAY=`cat ~/.last-display`'