I'm using a recent version of GNU Screen, supporting vertical splits.

Once I have split a window in 2, how can I switch so that they are both dividing the whole region in half horizontally versus vertical?

I need to change to horizontal in order to copy some text with mouse from one window without the visual selection overflowing and grabbing text from the other window.

Then I would need to switch back again to a vertical split from horizontal.

1 Answer 1


GNU screen doesn't come with any layouts predefined, so you need to roll your own. Here is what I've added to my ~/.screenrc :

# define layouts
layout new 'horizontal'
layout new 'vertical'
split -v
layout new  'main' 

# bind control sequences for new layouts
bind V layout select 'vertical'
bind H layout select 'horizontal'
bind ' ' layout next # <- actually means Ctrl-a + Space

With this it's possible to switch layouts with Ctrl+a Space | V | H.

(Actually, all control sequences start with Ctrl+a by default, so I'll omit it from now on.)

This solution is not ideal - after starting a screen session you initially have to tediously focus on each 'region' (parts of a layout) with TAB, and attach a process (man screen of all places insists on calling them 'windows' ) with n|p|0-9|Ctrl+c or a different method of your choice.

I imagine you'll want to detach instead of killing when possible.

... and this should hopefully cover your use case. Cheers!

  • Thanks for the revised solution. As you can write such a solution for screen but prefer tmux, it's time for me to check it out!
    – ljs.dev
    Oct 25, 2013 at 23:53
  • 1
    just as an update - I did move to tmux shortly after this and never missed screen at all :)
    – ljs.dev
    May 29, 2014 at 22:19
  • I looked ages for the vertical split: split -v, thanks a lot!
    – Daan
    Jul 29, 2016 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .