Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I restore a splitted session of screen, I've got only one print session and have to reconfigure the number of display session.

Is there another way to have the original screen configuration?

share|improve this question

This is not currently possible without a hack (see next paragraph); however, the features required to do this have already been added to screen's current git tree. In future versions, the "layout save" and "layout load" commands will be able to load not only your last layout, but other named layouts. I believe there is also support for cycling through layouts.

Currently, the trick is to use a screen inside a screen. All of your work and layout changes are done in the inner screen, but then when you detach, you actually detach from the outer most screen. The layout of the inner screen will be preserved. See the following for all the gritty details:

When I split the display and then detach, screen forgets the split.

Alternatively, you can try compiling the latest version directly from the screen source tree. You can do this by installing git and then running:

git clone git://git.savannah.gnu.org/screen.git

Then, follow the directions in src/INSTALL. In general, the directions are:

  1. ./autogen.sh
  2. ./configure
  3. make

There is a discussion in the INSTALL file about various issues surrounding where to install screen based on various concerns. If you go this route, your best bet is to read all of the INSTALL directions and then proceed.

share|improve this answer

I ran into this problem when I pressed a wrong key combination by accident, and all my split screens were gone. :((

However, there was a (humble) way out for me, at least. Since I mostly use screen together with xterm and bash shells, the last thing I wanted to have is launch any more bashes. (Controlling things with ps revealed the bash processes were there, but not accessible.)

So the way to get back to my usual setup was to use Ctrl+" and add one already running shell to each split window, cycling through the "panes" with Ctrl+aTAB. So I got things back to normal.
I'm posting this especially because I've come across people who, in their frustration, just pressed Ctrl+ac and "re-installed" their bashes. But this is silly! For with that method, you will end up with maybe 25 bash processes at the end of the day, with at least 15 of them inaccessible/invisible, just wasting resources and CPU for no reason. So reuse them, instead of recreating them.

share|improve this answer
    
what is ctrl "? i tried it, when reattached, when staring at the only one remaining "display sesssion", and it does nothing, then i pressed ^a tab, and that didnt take me to next, infact only things that does is ^a n – Brian Thomas Mar 19 at 3:31

Putty note: If your using putty, also go to terminal settings and check to disable the re size of terminal, save settings, then relaunch.

You have a few options, depending on which seems logical for your setup;

a) Use screen_layout if you have over version 4.2 and screen -X dump layout

b) Use the hack if you have ~4.0x http://aperiodic.net/screen/faq#when_i_split_the_display_and_then_detach_screen_forgets_the_split

This hack is a bit confusing in that you have to carefully notice that it states not-so-clearly that you need to launch a standard screen first, before you launch a screen with the .screenrc edits, because sessions wont hold data like that.

c) Compile and make install http://savannah.gnu.org/forum/forum.php?forum_id=8293 http://www.linuxfromscratch.org/blfs/view/svn/general/screen.html

d) Apply the patch instead of reinstalling (see below)

e) Get ahold of the binary for your distro, and place it in your path, so that it will override the systems default one.

hth, because i know one option is never enough.

Regarding d) above, I couldn't find the patch anymore, so ill include it here.

diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo
index 6142de0..6fc8f9e 100644
--- a/src/doc/screen.texinfo
+++ b/src/doc/screen.texinfo
@@ -1040,6 +1040,8 @@ Show or set which layout to reattach to.  @xref{Layout}.
 Remember the organization of a layout.  @xref{Layout}.
 @item layout autosave [@var{on}|@var{off}]
 Show or set the status of layout saving.  @xref{Layout}.
+@item layout dump [filename]
+Save the layout arrangement to a file.  @xref{Layout}.
 @item license
 Display licensing information.  @xref{Startup}.
 @item lockscreen
@@ -2107,7 +2109,10 @@ the layout to reattach to will be shown in the message line.
 Remember the current arrangement of regions. When used, @code{screen}
 will remember the arrangement of vertically and horizontally split
 regions. This arrangement is restored when a @code{screen} session
-is reattached or switched back from a different layout. If a number
+is reattached or switched back from a different layout. If the 
+session ends or the @code{screen} process dies, the layout
+arrangements are lost. The @code{layout dump} command should help
+in this siutation. If a number
 or title is supplied, @code{screen} will remember the arrangement of
 that particular layout. Without any options, @code{screen} will
 remember the current layout.
@@ -2129,6 +2134,21 @@ a single window. Without either an @code{on} or an @code{off}, the
 current status is displayed on the message line.
 @end deffn

+@deffn Command layout @code{dump} [filename]
+(none)@*
+Write to a file the order of splits made in the current layout. This 
+is useful to recreate the order of your regions used in your current
+layout. Only the current layout is recorded. While the order of the
+regions are recorded, the sizes of those regions and which windows
+correspond to which regions are not. If no filename is specified,
+the default is @file{layout-dump}, saved in the directory that the
+@code{screen} process was started in. If the file already exists,
+@code{layout dump} will append to that file. As an example:
+@example
+layout dump /home/user/.screenrc
+@end example
+will save or append the layout to the user's @file{.screenrc} file.
+@end deffn

 @node Window Settings, Virtual Terminal, Regions, Top
 @chapter Window Settings
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.