print logo

Screen

Screen is a virtual terminal that allows attaching / detaching of a "session" without the screen itself being tied to a real tty (ie, an xterm / rxvt and so on). Issuing commands within Screen is based around a command sequence, starting with a hardwired command prefix, which defaults to Control-a (abbreviated C-a). This can be changed, more on that later.

Usage

Upon starting screen (with just "screen"), you'll get a shell in return. This is "Window 0", to create a new shell contained within the screen session, use C-a c (mnemonic, "create"). To move between windows, use C-a n (mnemonic, "next"), or C-a p (duh). You can also use C-a # where "#" is a number from 0 to 9 to go directly to that window. Please note that screens command sequences are case sensitive.

Each window can have a name (settable with C-a A) and you can list and select windows directly via C-a ". Inline help is accessible via C-a ?.

To reattach to a running screen session from another shell, use screen -r -d. You can detach (this is strictly not needed) with C-a d.

 

Configuration

The default command setup of "C-a" is annoying, "C-a" for most shell users is "beginning of line"... But, this default can be changed in your ~/.screenrc. One suggestion is Control-o, which can be achieved in the following way:

 

$ cat ~/.screenrc
escape "^Oo"
defescape "^Oo"

 

By Terje Kvernes
Published Sep 12, 2014 01:25 PM - Last modified Sep 12, 2014 01:25 PM