Jump to content

Screen: Difference between revisions

63 bytes added ,  3 November 2012
 
(One intermediate revision by one other user not shown)
Line 89: Line 89:


followed by the id listed above of the screen you want to reattach to.
followed by the id listed above of the screen you want to reattach to.
=== Moving windows ===
If are in a window, but want it to move it to another, just type these commands while attached to screen and in that window, and replace '''x''' with the destination you want:
Ctrl + a
:
number x
For example, if you are in window number 2, press '''Ctrl+a''', then type the colon symbol (''':'''), then '''number 4''', to move that window to window 4.


=== Start and stop signals ===
=== Start and stop signals ===
Line 180: Line 189:
So, you've made your screen, configured it, and you happily type screen -dr '''every time''' you login to RedBrick. But wouldn't it be nice if whenever you login your screen would reattach '''itself'''??? It can be done :D
So, you've made your screen, configured it, and you happily type screen -dr '''every time''' you login to RedBrick. But wouldn't it be nice if whenever you login your screen would reattach '''itself'''??? It can be done :D


Simply use your favorite text editor to edit your ~/.zshrc (or ~/.[name_of_shell]rc) and paste the following code into it.
Simply use your favorite text editor to edit your ~/.zlogin if you're using zsh (if you haven't changed your login shell, this is the one you're using) or ~/.bash_login if you're using bash and put the following in it
 
if [ -z "$STY" -a $TERM != "screen" ]
then
    exec screen -dr
fi
 
That should do the job. However make sure to keep the spaces between the if statement, the brackets and the inside of the if statement (or it won't work).
 
In particular


  $TERM != "screen"
  screen -dr


is very important for that code segment to work, otherwise when connecting to another server (Carbon for instance), your shell will try to attach a screen session, fail and disconnect leaving you on the server you tried to connect from (Really quite annoying).
That should do the job. It'll try to reattach a screen whenever you login on any redbrick server


* Please note, if this in fact, does not work, you can edit it out by using winSCP and editing the file using it.
* Please note, if this in fact, does not work, you can edit it out by using winSCP and editing the file using it.
145

edits