It's the thing which you look at when you use a computer, or watch TV, or monitor an EKG, or whatever. It's usually square and has text or graphics on it, or some dh0rk on it if you're watching television. Computers make the best use of screens, having really high resolution and millions of colors.

GNU screen is a virtual terminal multiplexor. It virtualizes the concept of a TTY on a Un*x system. You can do all the following cool things:

  • Use the same terminal to connect to multiple sessions.
  • "Disconnect" from a session, and reconnect to it later. So you can disconnect from a modem session, then reconnect to the same processes at a later time.
  • Reconnect to a session from any other terminal.
  • Connect multiple terminals to the same session. Great for demonstrating how to do something in the shell (some security features, notably ACLs, provided).
  • Split the real terminal and display several sessions on it.

Think of screen as being a terminal emulator that runs on a terminal. This sounds idiotic, until you realize that this lets it add features to the terminal...

Contains too many features to explain here; get the package!

Roughly the same thing, for an X server, is the nested X server, Xnest.

screaming tty = S = screen name

screen n.

[Atari ST demoscene] One demoeffect or one screenful of them. Probably comes from old Sierra-style adventures or shoot-em-ups where one travels from one place to another one screenful at a time.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

Screen is awesome. No, seriously. GNU Screen, often just screen, is a supershell that lets you run other terminal programs, such as mail readers, text editors, shells, and so on, in a single terminal in the UNIX world. If you get confused with all the terminal emulators you need to run, screen manages them all. Even if you don't, it has enough features for you to use it anyway. And it is awesome.

You may be asking, "Why is screen so awesome? I am a lowly human being, what can a terminal multiplexer (for screen is sometimes called one) do for a poor soul like me?" Well I'll show you.

Silver Screen

I am going to pretend that you have access to screen here. If you do not, you can install it, follow along, or close your eyes and imagine. Whatever works for you.

Starting screen is simple enough:

$ screen

If you try that, screen will launch, and present you with... another shell, not entirely unlike the one you were at previously. But do not be fooled! Screen created a window with number 0, and started a shell on it. Try doing a ls, which is the first thing anyone does, and you'll find out that it works just like any shell.

Now, create a new shell by typing C-a c, or Control-a c. Your ls will have gone, and is replaced by a new, unused shell.

Where did the old shell go? Try pressing C-a C-a, and you'll be back at shell #0 (ls). C-a C-a is the switch window command, and it switches between two windows - in this case, window 0 and window 1.

Try making a third window - C-a C-a again, and run a ps aux to distinguish it from the others. This is window #2.

To get back to the first window (0, the one with ls), use C-a 0. C-a C-a won't cut it here, as it changes between the two most recent windows, neither of which is window 0. Similarly, C-a 1 goes to window 1, C-a 2 switches to window 2, and hopefully you should see a pattern emerging here.

Alternatively, C-a n goes to the next window in the list, and C-a p goes to the previous one.

Summary of new commands:
screen    = Load screen
C-a C-a   = Switch between two windows
C-a c     = Create a new window
C-a n     = Go to the next window
C-a p     = Go to the previous window
C-a <X>   = Go to window (Where X is a number)

Movie Screen

All these windows can get pretty confusing. If you've been following this node, you should have three windows open - 0: ls, 1: empty, 2: ps aux. Now, suppose you leave your computer to go to a dance lesson, and when you come back you've forgotten what all the windows are for.

But not to worry! Screen can show you the window list, when you press C-a ". Do that. You'll get a list, like this:

Num Name   Flags
  0 bash   $
  1 bash   $
  2 bash   $

Screen is smart enough to tell you that you are running three shells, but not clever enough to tell you what they were for - it just knows the name of the shell running in them.

This is where screen renaming comes in. Say you want window 1 to be your editor window. Switch to window 1 (C-a 1, remember?), and load vi, or emacs, or ed, or whatever. Now that you know that you're in an editor window, you can rename it by using C-a A - backspace over the "bash", and call it whatever you want. Our new window list:

Num Name   Flags
  0 bash   $
  1 editor $
  2 bash   $

We've got an editor, and two shells. Do we really need that extra shell? No, go to window 2 (C-a 2) and kill it by pressing C-a k. Answer y to the prompt to kill it real good.

Num Name   Flags
  0 bash   $
  1 editor $

It's always nice to have a tidy window list, like we do here.

Summary of new commands:
C-a "     = Show a list of windows
C-a A     = Rename the current window
C-a k     = Kill a window

Super Screen

Undoubtedly the best feature of screen is the ability to detach and reattach to a screen. Go back to screen, it doesn't matter what you're doing, and type the detach command, C-a d.

detached $

All your windows disappear, and you're unceremoniously placed back at the old shell.

What just happened? Screen did not close itself, it just hid itself - all your applications are still running!

At the prompt, you can then reattach the screen:

$ screen -r

And your windows will be there, unchanged. If you were in insert mode in Vim before, you'll be in insert mode now, too.

This is incredibly useful if you change computers a lot - using screen and ssh, you can take your environment with you wherever you go:

  1. ssh-agent, screen, set up your mail reader and editor
  2. Detach screen (C-a d), leave for school/workplace
  3. Arrive at workplace, telnet, reattach screen (screen -r)
  4. Get on with whatever you were doing

This is where the true awesomeness of screen lies. Some people have had single sessions of screen running for over a month, leaving their computer and reattaching screens whenever they need to.

Summary of new commands:
C-a d     = Detach from this session
screen -r = Re-attach to a session

On Screen

Hopefully you should be feeling the awesome power of screen by now, somewhere in the back of your cerebellum.

Ever wanted to watch your bittorrent downloads while on irc at the same time? Here are some other nice things to do in screen:

  • Watching a screen for noise (C-a M), telling you when someone talks in irssi or when you get mail in mutt
  • Watching a screen for silence (C-a _), telling you when your compilation is finished
  • Viewing the scrollback of a program (C-a escape), to see what you've been missing
  • Copying (C-a [) and pasting (C-a ]) lines from a window
  • Splitting a window into two new ones:
    • Use C-a S to split a window in half
    • Use C-a Tab to switch between them
    • Use C-a Q to join them together again
  • Nice help system (C-a ?) for when you get lost

Smoke Screen

Every respectable program has a .programrc, and screen is no exception. Here are some lines to put in ~/.screenrc:

escape ^zz
Remaps C-a to C-z. Useful if you need to use C-a in emacs.

startup_message off
Turn off that annoying message at startup

nethack on
Error messages from the Dungeons of Doom

hardstatus on
hardstatus alwayslastline Turning on the bottom status line, showing the windows. Very useful

hardstatus string "%{rk}%H %{gk}%c %{yk}%M%d %{wk}%?%-Lw%?%{bw}%n*%f%t%?(%u)%?%{wk}%?%+Lw%?"
Complex status line that shows the time, amongst other things

hardstatus string "%{= kc} %?%-Lw%?%{= kY}%n*%f %t%?(%u)%?%{= kc}%?%+Lw%?"
A much more simple status line

And that's pretty much everything covered. Have fun using screen!


This writeup was screened using screen on a screen. Yeah.

Screen (skrEn), n. [OE. scren, OF. escrein, escran, F. écran, of uncertain origin; cf. G. schirm a screen, OHG. scirm, scerm a protection, shield, or G. schragen a trestle, a stack of wood, or G. schranne a railing.]

1.

Anything that separates or cuts off inconvenience, injury, or danger; that which shelters or conceals from view; a shield or protection; as, a fire screen.

Your leavy screens throw down.
Shak.

Some ambitious men seem as screens to princes in matters of danger and envy.
Bacon.

2. (Arch.)

A dwarf wall or partition carried up to a certain height for separation and protection, as in a church, to separate the aisle from the choir, or the like.

3.

A surface, as that afforded by a curtain, sheet, wall, etc., upon which an image, as a picture, is thrown by a magic lantern, solar microscope, etc.

4.

A long, coarse riddle or sieve, sometimes a revolving perforated cylinder, used to separate the coarser from the finer parts, as of coal, sand, gravel, and the like.

 

© Webster 1913


Screen (skrEn), v. t. [imp. & p. p. Screened (?); p. pr. & vb. n. Screening.]

1.

To provide with a shelter or means of concealment; to separate or cut off from inconvenience, injury, or danger; to shelter; to protect; to protect by hiding; to conceal; as, fruits screened from cold winds by a forest or hill.

They were encouraged and screened by some who were in high commands.
Macaulay.

2.

To pass, as coal, gravel, ashes, etc., through a screen in order to separate the coarse from the fine, or the worthless from the valuable; to sift.

 

© Webster 1913


Screen (skrEn), n. (Cricket)

An erection of white canvas or wood placed on the boundary opposite a batsman to enable him to see ball better.

 

© Webster 1913

Log in or registerto write something here or to contact authors.