Kristian Lunde

www.klunde.net

Archive for the ‘GNU’ tag

Using GNU screen

without comments

Recently I’ve been the victim of a really unstable internet connection. This lack of stability has made me a great fan of the GNU screen command in unix systems.

GNU Screen is a small piece of software that lets you initiate a number of terminals inside a single terminal window. The great advantage with screen is that if you loose your internet connection, the screen terminals and operations inside these terminals still run on the server, contrary to operations running directly on the terminal window of your external server.

Screen is real simple and in most cases you only need a few important commands:

  • starting a session
  • listing all running sessions
  • attaching to a session
  • de attaching from a session
  • killing a session

Creating a new screen session

Command: screen

kristian@Saturn:~$ screen 

Example:

Listing all active screen sessions

Command: screen -ls

Example:

kristian@Saturn:~$ screen -ls
  1. There are screens on:
  2.  11179.pts-0.Saturn (Detached)
  3.  11114.pts-0.Saturn (Detached)
  4. 2 Sockets in /var/run/screen/S-kristian.

Attaching to a session

If only one screen session is active the command below will take you directly to the session. If there are several sessions running the command below will display a list of running sessions. To choose one of them the screen -r command has to be followed by the session name.

Command: screen -r

Example of several screen sessions running:

kristian@Saturn:~$ screen -r
  1. There are several suitable screens on:
  2.  11179.pts-0.Saturn (Detached)
  3.  11114.pts-0.Saturn (Detached)
  4. Type "screen [-d] -r [pid.]tty.host" to resume one of them.

Example of attaching to a screen session:

kristian@Saturn:~$ screen -r 11179.pts-0.Saturn

De attaching from a session

De attaching from a screen session is real simple just remember the key combinations :P

Hold the CTRL key down, press A, then D. Thats it.

Killing a screen session

Killing a session is as simple as de attaching from one, just use the correct key combinations.

Keep the CTRL button down, press A, then K.

Written by Kristian Lunde

May 27th, 2008 at 10:14 pm

Posted in Linux

Tagged with ,

Get Adobe Flash player