Screen - A Tool to Keep Sessions Alive

From aoxoaWiki
Jump to navigationJump to search

It is really annoyingto have an SSH terminal session running, have it terminate, and that kills whatever you were running.

Apparently the screen utility provides a solution. It seems to be a standard component, at least within OpenSuSE 13.1....

To use it, first start a remote session with SSH. Then when you want to run a command, use the screen utility. For example, I want to start up the minecraft PE server:

  <start a terminal session>
  ssh minecraft@servername
  <password if required>
  cd PE
  screen ./start.sh

If you want to use screen to keep a generic shell session open, try:

  <start a terminal session>
  ssh user@servername
  <password if required>
  screen bash

At this point, you can use the terminal session as normal.

If you accidentally close the terminal session, or if it disconnects, you can reconnect to it by:

  <start a new terminal session>
  ssh minecraft@servername
  <password if required>
  screen -r

The screen -r command tells it to reconnect. If there are multiple session, you will get a prompt asking which one to connect to..




Back to OpenSuSE Linux