Most modern Unix-based operating systems (e.g. Linux, MacOS X, and BSD) come with a little console-mode utility called GNU Screen. It’s a powerful tool in the hands of the console warrior, a veritable Swiss Army knife of text-mode human-computer interaction.
Yeah its awesome, if you have ever run q3 game servers its invaluable..
awesome if you write bash scripts aswell.
Awesome app.
Screen is probably the most useful tool I have on my computer. It is amazing how versatile it is. Detaching a session, and then being able to reattach it later through an ssh session from another box is one of the coolest features. I love being able to open a new session inside the same window also. It’s like the equivalent to tabbed browsing for terminals.
Screen is perhaps the only true must-have command line application out there. (Minus the shell and associated utils. )
I only discovered it in this article, and I am already addicted. It has already been very useful while editing some files over SSH using a troublesome Gigabit ethernet card I have here. I loose the connection every once in a while. Now I just have to ssh back in and all the work is exactly as I left it! Brilliant!
Shell account without screen is painfull to use! 😀
I’m surprised they didn’t mention multi display (-x). I must have done hundreds of Gentoo installs for my friends that way, allowing them to see exactly what I’m doing.
I´ve read an article in Freshmeat about an X utility inspired by Screen, but I don´t remembre the name.
It’s called xmove, it’s brilliant and, sadly, also out-dated / apparently no longer in active development. The ability to resume X11 sessions would be the best thing since sliced bread, if I could get it to work correctly.
Do you mean Ratpoison? :
http://ratpoison.sourceforge.net/
I don’t know what I will do without screen. Phone lines here are crappy and my dialup disconnect every few minutes on a bad day (which is often). Luckily with screen I can resume my SSH session most of the time.
screen deserves more publicity and recognition.
I’ve been using Screen since some time in 2002 and it’s really fantastic… I run a Screen session on my Uni’s Unix server with irssi and Pine open in it constantly, which means that no matter where I am, I can check my emails without resorting to webmail, and I can keep up with various friends on IRC. My housemate leaves his Screen session running on several PCs around our house (using the ever-useful -x argument) so that he can get at his stuff nomatter what room he happens to be in.
I’m sure, if I was conscientious enough, I could find a way to make it help me work on my coursework more efficiently too
I have been using screen since 1994, since then it is installed on all my macines, most usefull was in the begining when i was learning using unix, but if you don’t mind to type more and you are ready to learn something new, then you shouln’t use it, because it will make you lazy.
The truth is that we don’t need to use screen, to get processes in background and keep applications running.
For that we have functions and tools which are standard and are included in all unix-like systems.
We just have to use them properly.
Screen is not included in any of the unix-like distributions.
> The truth is that we don’t need to use screen, to get processes in
> background and keep applications running.
But that is a small example of what screen can do. There are a number of things which it does which I’m certain is impossible to do with the process management features in the shell. (Examples: grabbing background processes from another shell, viewing multiple sessions simultaneously, keeping I/O oriented applications *running* in the background, etc..)
But the real reason to use it is convenience. Typing ‘screen -r’ and having entire projects pop up in a ready to use state is bliss. As for it not being included with every system: I’ve compiled it on several systems so that I can use it (and it is included standard in Mac OS X, and I believe a couple of Linux distributions).
I’ve been using screen for seven or eight years now, and would find it difficult to live without it.
i’m sorry, i didnt’ get it much.
does it much different from ‘nohup’ ??
cheers,
Yes, it’s completely different from nohup and much more powerful.
Hi,
can anybody shed some light?!
[root@asp6 root]# su – notes
[notes@asp6 notes]$ screen
Cannot open your terminal ‘/dev/pts/0’ – please check.
[notes@asp6 notes]$
tia
Ratpoisen doesn’t let you detach. Xmove does (did)
That’s because your pty is still owned by the original user.
The easiest way to workaround this is to login as the notes user and then launch screen (ssh notes@localhost is probably quickest). This will allocate a pty owned by the notes user, and screen will happily launch that way.
I have been looking for a good screen tutorial for awhile, this definetly makes my day =).
Screen is great, but you can get the same effect in X windows using a VNC, such as RealVNC.org (only a couple hundred KBs to download, runs in user mode and has clients for linux and windows).
in the begining when i was learning using unix, but if you don’t mind to type more and you are ready to learn something new, then you shouln’t use it, because it will make you lazy.
I fail to see your logic. Even if it was possible to use all of screen’s features with built in commands (which it is not) why would I if screen is much easier and more productive? Screen doesn’t make you lazy it makes things easier. That’s not laziness, that’s intelligence. Work smarter not harder.
The truth is that we don’t need to use screen to get processes in background and keep applications running.
For that we have functions and tools which are standard and are included in all unix-like systems.
That’s true but there is more than that to screen.
I’ve used screen some in my time, but in the end, choose emacs for splitting up and switching terminals in a text-only environment. The one thing I really missed in screen is the ability to split my screen vertically. My configuration is often to have three windows/frames- on the left, I have a big one, usually around 80×50 and on the right, two 80×25 stacked. That is my preferred setup. In screen, I can’t do that- or I’ve not found out how. I can only split horizontally, which isn’t all that useful to me.
Sometimes, though, I use screen *and* emacs together, using screen just to get the ver handy detach and re-attach functionality.
If there is any way to get vert splits in gnu screen, let me know! Preferably via email, but I’ll check here later…
I use MacOs X,
On my terminal, I can view file names in Unicode (ls with -v option), and I can also enter directly any unicode String (with bash and some options in .inputrc), like if I want to create a directory with a Japanese name mkdir “JapaneseKanjis”.
But with screen, I couldn’t find a way to acheive that!
If you have any solution, I would be very happy 😉
May be awesome, but only for those monolingual ASCII guys as always…
I’m not sure how to set it up, but screen does support at least some utf8 encodings. They hang out in /usr/share/screen/utf8encodings (in debian). There’s also wide (doublebyte?) character support. Again, I have no idea how to set it up
Sorry I can’t give more details, I’m one of those monolingual ASCII guys.
And another thing, it’s worthwhile to upgrade the screen that comes with Mac OS X.
They ship 3.9.15, while the latest version is 4.0.2. There were some good bugfixes between then and now. I built and installed 4.0.2 with pkgsrc very easily. Fink and darwinports may have it was well.
screen -U
Screen, by default, uses Ctrl_a to do many of its commands, but this overrides emacs’s and bash’s ability to jump to the beginning of a line. Is there a way to tell screen to use a different hotkey?
(from the man page)
-e xy
specifies the command character to be x and the character generating a literal command character to y (when typed after the command character). The default is “C-a” and `a’, which can be specified as “-e^Aa”. When creating a screen session, this option sets the default command character. In a multiuser session all users added will start off with this command character. But when attaching to an already running session, this option changes only the command character of the attaching user. This option is equivalent to either the commands “defescape” or “escape” respectively.
Doesn’t seem to be included with R5, unfortunately.
> Screen, by default, uses Ctrl_a to do many of its commands, but this
> overrides emacs’s and bash’s ability to jump to the beginning of a line. Is
> there a way to tell screen to use a different hotkey?
Hit Ctrl+A and “a”, and screen will send ^A to the application.
Thanks! That was one of the small things with which i had a preblem with. I stumble around other weird things too, but i’m not sure wether they’re bugs. It’s a helpful program anyway, i love GNU Screen!
I wrote it for my lug.
http://www.dremspider.com/~dlohin/screen.pdf
It is a little more in depth than this one. It is being hosted on my web server, so just make sure this never gets on Slashdot 🙂
Here’s a script snippet to use in your .bashrc file so that you log into screen everytime you open a terminal.
This configuration will close any other session that you have open, and only maintain your one session.
SCREEN_SESSION=`set |grep screen`
SCREEN_PROCESS=`ps -u $USER |grep ” screen”`
if test -z “$SCREEN_SESSION”
then
if test -z “$SCREEN_PROCESS”
then
screen -q
else
screen -D
screen -r
fi
fi
My compliments to the author for revealing such a powerful and versatile tool to our community…
C-a C- (quit) Kill all windows and terminate screen.
It’s a wonder we all don’t already know about it yet… Thanks!
-Karrick
The termination command should have read,
C-a C-(backslash)
But the backslash didn’t show up after being processed… Sorry.
Actually, I’m glad screen get’s a mention again. I’ve seen it around here in there in articles from Sysadmin Magazine and such. It is after all the best console tool ever. Console tools get under estimated. Screen makes me loves programs like mutt, centericq, bitchx and all these non-gui stuffs. Rock on!
Just what i was looking for!
Works great on my OpenBSD serial console.
Googling on ‘xmove’ I came across a project called ‘Xmove IMproved’ at http://markballew.com/projects/xmove/ and the Links section points to another project called GUIevict at http://www.cs.wisc.edu/~zandy/guievict/
Enjoy.
Wowgh, it seems like there is really a lot of interesting stuff out there. Like this one called xmx at http://www.cs.brown.edu/software/xmx/tutorial/