Monday, December 14, 2009

concurrent Screen sessions shared

Advanced use of Screen

As mentioned earlier, you can create multiple, concurrent Screen sessions, where each session can manage a suite of windows. Each session has a unique identifier; use screen -list to catalog all available sessions. As with a window, you can name a session to refer to by its handle. Use screen -S label to assign a label to the new session.

Sharing is one of the best uses of a named Screen session. If permitted, you can connect to an existing session and collaborate with other users within any of the session's windows. You can even switch to another window within the session independently! If you're in the same window as another, anything typed or displayed is reflected to all partners. Let's try it:

1. Choose a machine to work on, and log in.

2. Type screen -S sharing -t one> to create a new Screen session named, aptly, sharing, and a new window named one.

3. Create a second window with screen -t two.

4. If you like, check your work with Ctrl-a, then d, screen -list, screen -r sharing, and Ctrl-a, then ".

5. Emit some output in the window named one by typing echo in that window.


6. On the same machine, open a second login window.

7. Within that window, type screen -x -r sharing -p one.
The -x option specifies multi-user mode; -p one attaches directly to the window named one. You should immediately see the same output as the other login session, as shown in Figure 9.

Using each login window, run UNIX® commands to produce output, click Screen keyboard shortcuts to switch among the windows in the shared session, and watch the results.

No comments: