82

I'm trying to learn how to use screen, in unix so that I don't have to open up several ssh connections and terminal windows just because I want to do more than one thing at the same time on a machine. I have found the split command quite useful, but I have a problem I can't seem to figure out of... how do I unsplit??

I can split split using ^A S and switch between them using ^A ^I, but can't figure out how to remove a split...

  • Do you want to maximize one screen or close one screen? – Mikel Feb 9 '11 at 8:32
  • 1
    @Mikel: Close one of them. But knowing how to maximize one as well might come in handy some day as well. I assume maximizing one means to close the rest? – Svish Feb 9 '11 at 9:21
75

ctrl-a,X doesn't work on my distribution either.

If you go into the help by pressing ctrl-a,?, you may notice that there is no remove command listed. (This is the case on my distribution, for some reason). Note that this means there is no keybinding for the command, but the command should still work using the "long form" that maxelost suggested.

Don't worry, you can still remove the current split using "long form": ctrl-a:removeenter.

In addition, you can bind the remove command to X by putting this line in your ~/.screenrc file (and then restarting screen so the changes take effect, of course):

bind X remove
  • In case you accidentally locked your session and root's password doesn't unlock, just open a new terminal/ssh connection and reattach the screen session. – valid Aug 21 '16 at 10:02
31

Just use ctrlaQ (given that a is your screen-command key) to close all splits. ctrlaX closes only active window, as maxelot commented.

For example this page documents screen splitting, and other useful keys for screen.

  • When I do <kbd>^A Q</kbd>, I get a blank screen with all my splits removed. – Svish Feb 9 '11 at 9:23
  • 4
    Maybe C-a X is more appropriate (remove). Btw., I prefer writing C-a : command RET for commands that I don't use often. I find it easier to remember the name of a command than its keyboard shortcut. – maxelost Feb 9 '11 at 9:33
  • @Svish I got that too, just follow with C-a n to get back to your window. – krs013 Nov 4 '15 at 3:22
8

CTRL a + Q unsplits and lets you remain on the current window

whereas

CTRL a + X unsplits and puts you on the following available window

The first one with Q is great as you may want to remain on the current window when you need bigger space :)

Of course after that, should you need to revert to split screen, you will have to do again the CTRL a + S and CTRL a + Tab with CTRL a + Space to get back but that's ok... That would be nice if there was a way to toggle simply back and forth.

  • 1
    Thanks for the c-A Q tip! But, note that 'Q' actually means "only": if one has more than one "window", c-A Q will make the current window the only window, closing all other windows. OTOH, c-A :remove will close only the current window. – aqn Apr 2 '18 at 18:10
  • FYI tmux has a 'fullscreen' toggle command. I don't know if there's an equivalent for GNU Screen that reverses the effect of C-a Q. – thiagowfx Oct 16 '18 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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