Basic Screen Usage

Screen allows you to crate extra 'screens' which you can then execute processes in. You can switch between open screens and 'detach' screens, making it possilbe to 'reattach' them somewher else. This means you can be working on the server in a screen on one computer in an ssh session. Then you can detach the screen and connect on another computer to exactly the same terminalscreen you left off to.

It also means that even when you are gone, or not connected through ssh, processes will continue to run. Your minecraft server is run in a screen, because otherwise, as soon as you disconnect the terminal session will terminate and all the processes running in that session will stop. Meaning your minecraft server will stop.

It is also reccomended when making large downloads, to use a screen, because it ensures that even if the ssh connection terminates for some reason, your download will continue.

Simple Usage:

Create a new screen with that name.
$ screen -S name
Deattach the current screen and make it essentially run in the background
ctrl-a d
Reattach the deattached screen. If you have multiple deattached screens, you have to specify the PID. Now lets look at some practical usage schenarios:
screen -r [pid]

Running a minecraft server in a screen:

Create the screen:
$ screen -S minecraftServer
start the minecraft server (instructions for creating a start.sh file like this are avalaibe at this guide):
$ cd minecraftServerFolder
$ ./start.sh
deattach the screen:
ctrl-a d
Now, the minecraft server will run in the backgroud normally untill either the VPS stops, the process is stoppped or you reattach the screen and stop the minecraft server. If you need to do matenance on the server or use the console, you can reattach the screen by running:
$ screen -r
this will once again open the console for you to access.


Running a download in screen:

Create the screen:

$ screen -S ImportantDownload
Choose directory and start the download:
$ cd DownloadDirectory
$ wget "http://www.largefiles.net/verylargefile.txt"
Now when the download is finished, do this to close the screen:
ctrl-a K

Was this answer helpful?

 Print this Article

Also Read

How to SSH on Windows using PuTTy

Download PuTTY Download PuTTY from the website. After you download PuTTY, launch the...

SSH Tools

A Secure Shell (SSH) client allows you to connect to your Virtual private Server (VPS) and...

Creating a Start.sh file

A start.sh file allows you to easily start your minecraft server from a terminal prompt, without...

How to SSH on Mac

Mac OS X has a built-in SSH client called Terminal which can be used to connect to remote...

Powered by WHMCompleteSolution