screen: a console-base window manager on steroids
February 14th, 2007 edited by lucasEntry submitted by Ico Doornekamp. DPOTD needs your help, please contribute !
GNU Screen is one of my all-time favorite Unix tools. According to the official documentation, Screen is a full-screen window manager that multiplexes a physical terminal between several processes.
So, what does that mean ? GNU Screen allows you to run multiple console based applications like editors, shells, IRC clients, newsreaders, etc, all through a single terminal. Screen allows you to switch between applications or layout multiple windows in a single terminal. One of the most nifty features is that the programs running under Screen’s control can be detached - this means they are still running, even though the actual terminal is closed. Later a new terminal can be reattached to a running screen session, even from another host!
Here’s a small demo of a typical Screen session, the true story of Bob the system administrator:
Bob connects to the server and starts a new screen session.
bob@server$ screen
Screen displays its welcome message, and after hitting the Return key, a new shell is started.
Copyright (c) 1993-2002 Juergen Weigert, Michael
Copyright (c) 1987 Oliver Laumann
This program is free software; you can redistribute
it and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation; either version 2, or
(at your option) any later version.
[Press Space for next page; Return to end.]
This shell is now running inside the Screen session. Bob starts his favorite editor…
Password:
server:~# vi /etc/apache/httpd.conf
… and does some heavy editing.
Order deny,allow
Deny from all
Allow from 10.0.0.
/etc/apache/httpd.conf 993,25 94%
– INSERT —
But then disaster strikes: The CEO comes in and trips over the uplink network cable, breaking the SSH session!
connection lost. (Connection closed)
bob@desktop$
Screen to the rescue! Bob starts a new SSH session to the server, and now runs Screen with the -x parameter.
bob@server$ screen -x
Instead of starting a new session, screen now reattaches to the running screen session, and Bob finds his editor just the way he left it!
Order deny,allow
Deny from all
Allow from 10.0.0.
/etc/apache/httpd.conf 993,25 94%
– INSERT —
While editing, Bob decides he needs to check his mail. Instead of opening another SSH session to the server, he hits C-a C - that is, he types Ctrl-a and then ‘c’.
Screen now creates a new window, opening a new shell…
…and Bob starts ‘mutt’, his mail user agent.
2 + Dec 22 Daniel Hirschi (0.6K) Implementing s
3 + Jan 06 Ricki Silversto (3.0K) Paycheck
4 + Jan 26 Roberto (1.0K) Read this!
5 C Jan 26 Michel Wraith (9.0K) RE: finished
—Mutt: ~/Maildir [Msgs:5 19K]—(threads/date)—(a)
With the keystrokes C-a 1 and C-a 2, Bob is now able to switch between vi and mutt, from the same console.
Time to go home. Bob hits C-a D, which will detach the current screen session from his terminal, and takes the bus home.
[detached]
bob@desktop:$ logout
After dinner, Bob decides to finish the job. From his home computer, he opens a new SSH session to the server, and reattaches to the running screen session:
bob@sever$ screen -x
The editor and mutt are still running, and Bob can now continue his work from home from the point he left.
Order deny,allow
Deny from all
Allow from 10.0.0.
/etc/apache/httpd.conf 993,25 94%
– INSERT —
Screen has been available for ages in both Debian and Ubuntu.
Posted in Debian, Ubuntu | 16 Comments »