...making Linux just a little more fun! |
By David Dorgan |
Useful features of screen
This is a very basic introduction to some of useful features of screen.
I learned to use screen after I saw what it could do, it has some very good uses, basically screen is a screen manager with terminal emulation. The best way to see how it works and how it could be useful for you, is to use it. I'll give you one reason why I use it, I use irc allot, I don't mind idling and letting my client stay on, or sometimes I used to leave it on and then have to kill the connection if nickserv was available on that server, but with screen I login from a server I use, I just login and 'attach' the session, and I can detach it and reattach from any machine I like, because the virtual screen is always there.
For a really basic example, install screen, then run screen
by typing screen,once inside this type vim myfile.c,now
type Ctrl A
, and then hit the d
key. Now you should
be back at your normal shell, now type screen -list , and you will see there
is one screen session belong to you, now type screen -xto reattach
this session. Now you will see the same session, now if you have an account
on a remote host, maybe login and do the same with IRC, then detach and
reattach, and you will see all the new messages too, and you can do this with
any terminate application from anywhere, useful isn't it?
Now just so that you know, you can have a few sessions running and one easy way of re-attaching would be do to a screen -list and then screen -R $screen_number .There are betters ways to handle this, but for more information on that in the screen man page.
Now say you want more than one shell per screen session,
start screen, then type echo 'this is number one' ,then type
Ctrl-A
and n,
now you should see another new window,
now hit ctrl-a
and0,
you should now be back to your
first terminal, you can create a number of these, to destroy one just type
ctrl-a
and k, ctrl-a and p will bring you to the pervious
window and ctrl-a n will bring you to the next. For help type ctrl-a ?
.
There are many other things you can do, just read the man page.
$Id: using-screen.html,v 1.3 2003/08/30 15:00:35 davidd Exp $
David has been a very productive writer and plans to contribute more of his
work in the future.