Inside Paulo Abrantes' head
[ start | index | login or register ]
start > 2006-01-25 > 1

GNU screen Kung Foo

Created by pabrantes. Last edited by pabrantes, 2 years and 281 days ago. Viewed 960 times. #3
[diff] [history] [edit] [rdf]
labels
Category:IT
attachments

GNU screen Kung Foo

I've noticed that many people don't know GNU screen, eventhough it comes by default in almost every *nix OS - this includes linux, BSD, the new Mac OS, Solaris,etc. Latelly screen has been incredibly usefull for me while doing some remote administration jobs for >>feax.net.

But what is screen? Reading screen's man page, you can find the following

Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).
In a simpler, way imagine those multiple desktops environments you have in X11 (or even under Windows or Mac OS, although they are not so common) where you can add or delete virtual desktops and switch between them, screen is the same thing but for terminals.

Why not open multiple terminals? Well because it can get a real mess! Believe me, I have dual display and I still remember that before using screen I had so many xterms that it seemed that I had black >>post-its in my display. Besides, if you are working on a remote machine it's better to have only one ssh connection and spawn 20 terminals within screen, instead of having 20 connections to the remote host.

I'm sure that with the last explanation there are probably some users that are not really convinced about screen, but let me tell you about another killer feature. Screen allows you to dettach terminals, in other words, it can make things go into background, without loosing any of their output, and they'll be there until you reattach it. So if you're in a remote shell, you can always dettach your wget process and logout.

Last but not least, screen allows you to have, in a single window, multiple terminals, it gets really handy when you need to be copying stuff from one file to another.

Anyway I leave you some hints so you can start discovering the world of screen. While in a shell type screen, it will seem that nothing was done, but a new screen was initiated, now you can split your screen, add more screen, switch between screens, etc.

You can now use the following commands:

KeysCommand 
Ctrl-a + ccreate a new window with a shell 
Ctrl-a + nnext window 
Ctrl-a + pprevious window 
Ctrl-a + kkill current window 
Ctrl-a + "Shows a list with all the windows, from where you can select one 
Ctrl-a + NSwitchs to window N, where N is a number from 0 to the number of windows you have 
Ctrl-a + dDettach screen 
Ctrl-a + SSplits current window into two 
Ctrl-a + TABSwitchs between splitted parts 
Ctrl-a + _Monitors for silence 
Ctrl-a + MMonitors for activity 

Somes notes about the commands:
  • When you split a window the new part will have no shell spawn into it, when you switch to that part just use Ctrl-a + n or Ctrl-a + " to select the window you want there.

  • After you dettach the screen, you're back to your normal shell, there are two basic commands you have to keep in mind:
    • screen -list which will list the screens that are running and in what pts they are running
    • screen -x PTS reattach reattachs screen that is running in the pts PTS

  • The last two commands, the monitoring commands, are a state of art in productivity improvement. Instead of regularly checking background windows if a compilation has ended or a program is spitting it's output you enable, respectivily, the silence monitor or the activity monitor and you'll be alerted automatically for such events.
Please login to www.pabrantes.net.
Who am I?
paulo-roca2My name is Paulo Abrantes AKA pabrantes and I'm a software developer. I'm currently employed at >>CIIST working as a Java developer in >>FenixEDU.

This blog is mostly about Java programming, domain driven design and snipsnap bliki developing. Everything written in this blog is my personal opinion and it may not reflect the opinions of my employer and co-workers.


Blog subscription
subscribe by rss subscribe by email

Links
>> Home
>> Paulo's Profile
>> Post History
>> Add to Technorati Favorites
>> Paulo's Photo Gallery
>> WishList
>> Posting without Login

Search Blog
Fellow Bloggers

Recent Posts

Java Programming: Bytecode Injection
Intermission: Sorry For Downtime
Software Developing: Studying The Bliki Domain Model
SnipSnap Developing: Trying to settle a roadmap
System Administration: Load Balancing with Apache
Blogging: Two years have passed
Software Developing: The SnipSnap Saga
Java Programming: Getting your code spicy with Groovy
Software Developing: Fluent Interfaces
Software Developing: Implementing a ShoutBox on SnipsSnip
Software Developing: SnipSnap, SnipIt and SnipSnip
Java Programming: Proxies and Access Control
Java Programming: Proxies and References
Java Programming: References' Package
YALM: Yet Another Layout Modification

For older posts, please refer to post-history for a complete Post History

Logged in Users: (0)
… and 2 Guests.
This is a modified version of snipsnap.org created by >>Paulo Abrantes