Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Forums
Linux Articles
Product Showcase
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Free Publications


GNU Screen or screen in short is something I discovered late in my UNIXromance. Now that I have got hooked to it there is no going back. One ofthe first packages I install on any linux distro is this marvellouscreation. Let us take a dekko at this and see what makes it soversatile.

It is a window manager you can run without having to run X window. And you can run this from inside an xterm too of course. But for most folkswho have used screen for some time forget that it is some kind of a window manager like windowmaker or fluxbox.

Instead it comes across as a powerful tool for collaboration for instance. Using screen, it is possible for a remote user to view the commands you are typing in real time. He gets a remote display a la vnc.Of course it goes without saying how useful this can be in debugging problems and in handling support calls.

But that is just the tip of the iceberg. There are so many other niceties. It is a wonderful way to seamlessly save sessions on a remote machine in case your local machine gets rebooted or hung. Sessions arenot written to disk but can always be retrieved from main memory.

GNU Screen has a copy/paste facility without using a mouse. It has screen dump facility, history mechanism and so on. This comes as a great boon to command line junkies like me.

It can be locked easily and detached and re attached at will. Either as a multi display mode or single display.

And it displays what you want it to show in the status line on the bottom of the screen. For instance, my ~/.screenrc has

shell -${SHELL}

caption always "%n(%t) : %C"


This displays the screen number, the title in brackets and the current time. I find this adequate for my needs. You can write one to suit your taste.

You can either suspend and resume individual processes (including the shell) from inside of screen or suspend the entire screen itself.All screen command sequences start with Ctrl-A. So what to do if you wish to enter Ctrl-A to move to the beginning of the line in bash?

You type "Ctrl-A A" and voila! Screen passes it as Ctrl-A to bash.

In fact most hairy debugging and logging problems are elagantly solvedthe moment you put screen in picture.

I hope at least you discover the magic of screen early in your UNIX career...

 
Rate This Article: poor excellent
 
Comments about this article
Screen - ps
writen by: Sirisha on 2008-11-26 01:48:55
Hi I tried screen command and faced this scenario. Hope you will be able to help. I logged back into system after 2days of starting a screen. system didn't allow me to reattach. it said no screens. i tried ps to check for the programs i started in screen. nothing showed up. But I could see the programs running and generating relevant logfiles etc. another little experiment i tried - opened screen, ran a program, detached, logged off. logged back in, tried ps - program doesn't show up. program still running, generating logfiles. tried screen -r, this time it worked. maybe because it was immediate. if it makes sense. and it you have an explanation please share. thanks for your time.
RE: Screen - ps written by Sirisha:
RE: Screen - ps
writen by: jpotts on 2009-12-28 22:26:20
Perhaps by now you've found your answers, or have given up and moved away. But here goes: i suppose you didn't go very far with the "ps" command: "ps" without options will not show your Screen sessions, whereas "ps x" will. Next, if you had studied the Screen manual page (screen(1), "man screen"), you would've learned that "screen -list" would enumerate your sessions, if there were any to be found. And apparently there were, since your "screen -r" connected you back.
Reply to jpotts:
Screen Reattach
writen by: Denny on 2008-12-22 16:46:50
RE: Screen Reattach written by Denny:

Comment title: * please do not put your response text here