jay reads (3):
Who's reading jay (7):
Related Sites
Screen is a must have for anyone that works on remote boxes via the command line. There are many reasons for this, but a few of them are:
1.  screen is an easy way to allow processes to continue running after the session is terminated
2. if you lose connection screen will save your spot

Unfortunately, screen has a bit of a learning curve. First, let's install it.

On ubuntu the install is as easy as
$ sudo apt-get install screen

Unfortunately there is an oddity in screen on ubuntu that needs to be fixed. In many circumstances the backspace key will behave as delete instead and attempts to use it as normal will often result in an error message of 'wuff wuff'. I'm not making that up :/
This is solved by adding the following line to your .bashrc file
alias screen='TERM=screen screen'

After adding that line run:
$ source ~/.bashrc

Ok, now that we're setup let's use and learn the basics of the screen command.

Start screen:
$ screen
or start it and give it a meaningful name
$ screen -S myScreenSession

It will display a message and ask you to hit enter. Hit Enter :)

Now you are running in screen. You can create multiple windows inside screen and switch between them. This is really useful when you want to leave a process running (i.e. a connection to mysql, etc) while you do something else. Most importantly it will keep the connection alive even if you disconnect from the server.

To create a new window hit ctr-a c
To go back to the other window hit ctr-a p (p fore previous, use ctr-c n for next)

If you want to disconnect from screen and leave your processes running hit
ctr-a d

To connect to an existing screen session run
$ screen -x
or to connect to a specific session
$ screen -r myScreenSession

To get a list of existing screen sessions:
$ screen -ls



del.icio.us Digg reddit StumbleUpon

Comments

  • silverwhisper said on Mar 19, 2007....
    i'm not a techie but i'm hoping to glean a few things by reading here.

    ed
  • anonymous said on Mar 04, 2009....
    I also wrote a linux screen tutorial on screen some time ago. It may be good for non-techies. I find it to be one of the most underutilized programs around.

Comment on "An introduction to the linux screen command"

linux command line screen ubuntu remote command lines (Click to add tags below)

(Separate tags using commas, for example: New York, dating, vegetarian)
Comment Anonymously

Linux the open source OS on rampage.This could be Windows worst nightmare....