GNU Screen

From JasonAntmanWiki
Jump to: navigation, search

GNU Screen (Wikipedia) is, according to its GNU homepage, "full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells". Screen is run at the command line, and allows you to have flexible control over running multiple processes from one shell. A few of the things that screen allows you to do are:

  • Logout while leaving a process running, and come back to it where you left off.
  • Run multiple interactive (or non-interactive processes) in the same shell
  • Run multiple processes on the same screen at the same time

and more.

Contents

Keystrokes

In these examples, I will use the standard of abbreviating a Ctrl key combination as C-x, where x is the second key (pressed simultaneously). A space between key sequences indicates that they are pressed in order.

Exit screen C-d
Exit screen, but leave attached processed running in background C-a d
List detached sessions screen -list
Resume screen session screen -r [PID]
Start a new (named) session screen -S [name]
Resume a named session screen -r [name]
Start a named screen session with an initially running command, then detach it:
    screen -S ekg_session -md [command] &

Create a new tab C-a c
Change title of active tab C-a A and enter name
Create a new tab and start running a program in it (tab gets program's name) C-a : screen [program name]
Next tab C-a n
Previous tab C-a p
List all tabs, to select one C-a "

Split screen into two regions C-a S
Switch regions C-a [tab] (then C-a c to create a shell in an unused region)
Resize a tab C-a : resize [size] where size is the height in lines


Code to Create Tabs

Te following code in your ~/.screenrc file will create tabs in screen, such as those in a web browser. Each tab will have a number, name, and date and time:

hardstatus alwayslastline
hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}
%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'

Quick Reference

My (personal) quick reference is available locally as a PDF or the original ODT file:

External Links

GNU Screen quick reference

Views
Notice - this is a static HTML mirror of a previous MediaWiki installation. Pages are for historical reference only, and are greatly outdated (circa 2009).