How to split the terminal into more than one "view"?

  • From vi, if you issue the command :sp, the screen splits into two "views", allowing you to edit more than one file from the same terminal.

    Along those same lines, is there a way to have multiple shells open in the same terminal?

  • shellholic

    shellholic Correct answer

    10 years ago

    You can do it in screen the terminal multiplexer.

    • To split vertically: ctrla then |.
    • To split horizontally: ctrla then S (uppercase 's').
    • To unsplit: ctrla then Q (uppercase 'q').
    • To switch from one to the other: ctrla then tab

    Note: After splitting, you need to go into the new region and start a new session via ctrla then c before you can use that area.

    EDIT, basic screen usage:

    • New terminal: ctrla then c.
    • Next terminal: ctrla then space.
    • Previous terminal: ctrla then backspace.
    • N'th terminal ctrla then [n]. (works for n∈{0,1…9})
    • Switch between terminals using list: ctrla then " (useful when more than 10 terminals)
    • Send ctrla to the underlying terminal ctrla then a.

    Tmux also does this, and many terminal programs have split views and tabs.

    I'm having some trouble splitting my screen (either vertically or horizontally) under Centos 5 using zsh (under Virtual Box). When you refer to "uppercase one" for ctrlaS, do you mean that I should hold shift or use caps lock, as neither of these seem to be working. Apologies in advance if this is a noob question. OFF TOPIC - I'm not completely sure why my markup isn't working - I have already tried to follow the guidelines here http://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-overflow-server-fault-and-super-user

    @AaronNewton `ctrl+a` then release everything then `shift+s` (don't know for caps lock, mine is disabled)

    @shellholic - cheers. This takes a bit of coordination, but I just got it to work.

    `Ctrl A Shift S` splits the screen, then `Ctrl A Tab` switches to the other split, and `Ctrl A c` creates a bash prompt. Is there anyway to have these commands run automatically when starting `screen` so we don't have to run the commands all the time.

    Which version of screen for the vertical split? The version I have installed is 4.00.03, which is the same as the latest available download from from all the mirrors I've checked.

    According to the docs, you press escape, then press ctrl-a, then |.

    How do I make one of my vertical windows wider than the other? I want like a 30|30|40 split.

    @naught101 As of the most recent version I pulled from (sourceforge? github?), vertical splits are in standard releases now.

    Using screen, is there a way to scroll up to see information which pushes off the top of the split when you do, say `ls -al`?

    Vertical split doesn't work for me. I have this version Screen version 4.00.03 (FAU) 23-Oct-06

    @thanos.a your version is _very_ outdated. Current version is in this git repo.

    Can I do this programatically? I guess I can send some input with `expect`, but how to do Control and sequences?

    If you can not type the | character. You can still split using ctrl+a then : then split -v, as a command inside the screen.

    Does this work in ububntu? I have tried it but failed

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM