barnskilinux

Friday, December 01, 2006

GNU screen is like a window manager for terminal sessions - when you invoke screen, you can have multiple terminals (screen windows) open and running different processes, a bit like having the multiple desktop spaces in Gnome or KDE.

You can also "detach" screen, which puts all your active screen windows into the background and returns you to your default terminal session. You have now quit screen. This is a bit like disconnecting from a terminal server session - you can log off and log on again later from another machine, and re-attach your screen session. At this point, you can pick up all the processes you left running in your screen windows.

Invoke by using
screen

Screen windows are numbered 0-9

Create a new screen window with
ctrl-a c

Switch to next screen window with
ctrl-a n

Switch to previous with
ctrl-a p

Switch to screen window x with
ctrl-a x

Detach a screen from terminal (put screen windows in background) with
ctrl-a d
note that closing a terminal session without logging out also appears to detach active screen windows.

A detached screen (including all it's windows) can be resumed by invoking screen with the -r option:
screen -r
if you have multiple disconnected screen sessions, you will be told how to reconnect to one of your choice.

This pretty much covers what I need GNU screen for right now, but as is often the way with GNU/Linux software, it is immensely powerful and does way more than this. A screen users manual is here.