I’ve never been an avid user of GNU Screen despite a number of people giving it rave reviews. I never needed to resume remote sessions and the window management stuff seemed pointless (“Why not just open a new tab in gnome-terminal?!”).
However, today I discovered that newer versions of Screen are capable of splitting the terminal window horizontally and vertically. A light bulb came on, and after a bit of experimentation I wound up with something that looks like this:
One window for editing, one for server output, one for shell commands and git. I’d normally use different tabs for this stuff, and now here it is — all in front of me. This is more like it! Something I’ll actually use.
Since it took a little digging to track down the relevant documentation, I thought it might be worth documenting how I got my screen session to this point:
1. Open a new terminal and execute “screen”
This should present you with the command prompt (you may get a message regarding GNU Screen licensing — simply hit “return” to skip this).
2. Split the screen vertically
|Press CTRL-a SHIFT- (CTRL-a||) to split the screen vertically.|
You can use CTRL-a TAB to switch between the panes. Note the blank pane doesn’t do anything useful yet.
3. Start a command prompt in the blank pane.
Press CTRL-a TAB until you’re in the new, blank pane, then press CTRL-a c to create a new window with a command prompt in this pane.
4. Split the right pane horizontally
Ensure the right pane has focus (press CTRL-a TAB until the cursor is in the blank pane), then press CTRL-a SHIFT-s (CTRL-a S) to split the pane horizontally.
Again, the new pane is blank and seemingly unresponsive.
5. Switch to the lower right pane and create a new session.
Use CTRL-a TAB to move focus to the lower right pane we just created, then CTRL-a c to spin up a new shell prompt.
6. Use CTRL-a TAB to move between the panes and start coding!
Other useful commands
- CTRL-a SHIFT-x (CTRL-a X) will close the pane that has focus
- CTRL-a d will detach screen from the TTY and put it in the background. Resume with screen -r
- CTRL-a n and CTRL-a p shifts input focus to the next & previous window, respectively.
- CTRL-a SHIFT-a (CTRL-a A) will ask you to set the title of the focus window.
- CTRL-” list available windows