Sunday, September 11, 2011

Nested screen sessions

I have been using GNU screens since few years but never thought of using nested screen SESSIONS. Nested screen sessions comes handy when you want to SSH to other server from screen WINDOWS. Here is my recipe for handling nested screen sessions.

* ssh jayrajput@serverA
* screen -e ^Ee # Change escape character from Ctrl-A to Ctrl-E. see escape function in man screen.
* screen -d -m -S serverA # Create a new detached screen session named "serverA" on serverA in detached mode.
* screen -x serverA # Attach to the "serverA" screen session.
* Ctrl-E + c # create a new screen window
* ssh jayrajput@serverB # ssh to serverB
* screen # Run screen on serverB


Use Ctrl-A as command leader in inner screen sessions .
User Ctrl-E as command leader in outer screen sessions.

Setting the hardstatus your .screenrc also comes handy

hardstatus alwayslastline
hardstatus string "%t"

This will show the hostname in the outer screen session status. Do not know why but it does show the hostname.

No comments:

Post a Comment