Print View

Setting Up Screen
Created: 10/17/2006


General Information

This guide is about a utility that is called Screen.  It's in the ports collection of FreeBSD and it lets you setup a virtual Shell enviroment which you can connect and reconnect to even when you where totally disconnected or turned off the client PC.

I use it a lot for compiling and for programs I cannot fork to the background on remote systems.

Requirements

  1. Up to date ports collection.
  2. root rights or sudo rights.

Installation

First we are going to install the screen utility.
# /usr/ports/sysutils/screen/make install distclean

Usage

When the compiling is done we can start the program with the following statement
# screen -mS <insert_name_of_screen>
Now you are automatically connected to the inside of the screen program.  We can start any program just like a normal shell.
# top
to leave the screen press the following keys "CTRL+A" let go of the keys and then press the "d" key.

Now you see the words screen detached, you are back in your own console space.  You can disconnect the server or continue working on something else.

When you want to check/close the screen you can do the following command.
# screen -ls
Now you can see a list of active virtual consoles that are running.  With the following command you can re-attach a running screen
# screen -r <screenname>
You can totally let the screen exit by pressing the "q" key.

You can probably imagine tons of scenarios where this utility can come in handy so I don't think I need to explain more about this, just try it and see how it works.

Author: ShadowBumble
ShadowBumble at hotmail dot com



1 Comment

Posted by Murf on November 04, 2006 at 2:57:56 pm EET

Great to introduce screen!

But I find it easier to create windows within a screen session instead of running multiple screens.

ctrl-a c : creates a new window
^a " : lists current windows and lets you choose one. The default name of the window can be changed with ^a A

Select a window with ^a [1...9]

lock your screen session ^a x

To detach : ^a d

to reattach: screen -raAd

Screen is crazy powerful

http://www.slac.stanford.edu/comp/unix/package/epics/extensions/iocConsole/screen.1.html for the manpage sorry to say most how-to's arent that great and mostly very short.


Copyright 2003 - 2008 BSD Guides.  All rights reserved.

About | Terms of Use | Privacy | Contact