Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

man screen:

   Screen is a full-screen window manager that multiplexes a physical ter‐
   minal between several processes (typically interactive  shells).   Each
   virtual terminal provides the functions of a DEC VT100 terminal and, in
   addition, several control functions from the ISO 6429  (ECMA  48,  ANSI
   X3.64)  and ISO 2022 standards (e.g. insert/delete line and support for
   multiple character sets).  There is a  scrollback  history  buffer  for
   each virtual terminal and a copy-and-paste mechanism that allows moving
   text regions between windows.


   When screen is called, it creates a single window with a  shell  in  it
   (or  the  specified  command) and then gets out of your way so that you
   can use the program as you normally would.  Then, at any time, you  can
   create new (full-screen) windows with other programs in them (including
   more shells), kill existing windows, view a list of windows, turn  out‐
   put  logging  on and off, copy-and-paste text between windows, view the
   scrollback history, switch between windows in whatever manner you wish,
   etc.  All  windows  run  their  programs completely independent of each
   other. Programs continue to run when their window is currently not vis‐
   ible and even when the whole screen session is detached from the user's
   terminal.  When a program terminates, screen (per  default)  kills  the
   window  that  contained  it.  If this window was in the foreground, the
   display switches to the previous  window;  if  none  are  left,  screen
   exits.

With the technical explanation out of the way, how does it differ from say, creating tabs in a regular gnome terminal?

For the list of things you can do from the manual, I can already create new tabs, kill tabs, view a list of my tabs, switch between windows. Is it just more convenient with screen? Could someone explain in layman's terms the benefits?

share|improve this question
    
On second thought maybe I should've asked in superuser, but I figured a lot of server admins would be hanging around here so it's kind of a split decision. –  meder Aug 10 '10 at 15:43

6 Answers 6

up vote 8 down vote accepted

Right out of the man page you C&P'd:

Programs continue to run when their window is currently not visible and
even when the whole screen session is detached from the user's terminal.

Simply put, when your internet connection blows up your screen'd programs keep running, and when you log back in you can re-attach to that session.

Among other times where this might be useful are times where you would use nohup, e.g. running a script that can break network connectivity for a few seconds (having your session die and your script go away from SIGHUP can leave you with your machine off the network).

I don't know many people who use the "screen management" features of screen, but I know lots of people who detach programs to keep them running after they log out.

share|improve this answer
    
screen+irssi=bliss –  trent Aug 10 '10 at 20:38

If you know how works microsoft remote desktop, you easily understand how screen works. Mostly same except text-console only. So you could detach (disconnect) from screen console, and later reconnect to leaved session. Use hot-keys to switch between windows in screen, copy, paste, freeze, kill and so on.

So main benefit, is save you state of console if you suddenly disconnected from host where screen is initialised, so you could reconnect back to the host and re-attach last time session.

screen -Dr (disconnect if connected anyone else and connect to the session) C-a a C-a space C-a backspace For window rotate C-a c # to create new windows read man for more, but this one are most usefull hot-keys

share|improve this answer
    
The same thing can also be said about VNC. –  Cristian Ciupitu Sep 10 '10 at 22:49

For SSH sessions, it's a godsend. Instead of having 5 concurrent sessions (i.e., TCP connections) for tab functionality on a remote server, you can have 1.

Now, imagine if you had to administer 5 different servers with 5 tabs on each. You would have 25 separate tabs. With this you can just have 5 tabs, and then you know which server you're on.

Another huge benefit is that you can log off (in this case, close the tab) from the TTY and then reconnect later and still have your session. This is extremely helpful for administering servers as well as at home if you just want to bring up a session later but don't want to keep looking at it for hours while working on other stuff.

share|improve this answer

I have also used screen to do a "Screen Sharing" session to my team members, showing a demo or showing how something works.

With screen you can have multiple users "see" and "work" on the same console. Useful for a demo or KT..

How-to: http://ubuntuforums.org/showthread.php?t=299286

share|improve this answer
    
That's actually an interesting application of screen (though OMG a security hole you could drive a fleet of trucks through!) –  voretaq7 Aug 11 '10 at 15:24

With screen you can re-attach to a screen session from another pc or after you have restarted your pc. You can leave running an ssh session on a server without leave your terminal open.

share|improve this answer

Did you know what you can even create split windows with screen ?

Splitting the screen in half horizontally

Screen has the ability to split the window into two or more half horizontal windows. This feature will enable you, for example, to work in a half screen, while viewing the system resources ("top") in the remaining half.

To split the screen in two, first create two screen sessions. Then press Ctrl+a S which will split the screen in half, giving you a session on the top that you're already using and a blank session at the bottom.

To move to the bottom half, press Ctrl+a, then the TAB key. This key combination will move the console cursor to the lower half. Once in the blank half, you have to set this bottom half of the screen to use one of the two earlier created sessions. To do this, press Ctrl+a, then " (shift+'). You will be presented with a list of available screen sessions, pick one using the arrow keys (be careful not to pick the one already at the top or you'll have a mirror console), and activate it by pressing Enter. Now type top and switch to the upper half by pressing again Ctrl+a TAB. You should now have a bash prompt waiting for commands in the upper half and system resources monitoring in the bottom half.

To return to full size screen, switch to the half you want it to remain and press Ctrl+a Q.

There is also a patch to split windows vertically, but it is not a default setup.

I find this very useful, when I have to tail logs and startup apps (like tomcat) at same time ...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.