Learning how to use Screen with Ubuntu and Minecraft

An interesting challenge this. It’s half term and I’ve offered to start a Minecraft server for the children while I’m in the office. There’s no great distraction – start the Azure server, run the Minecraft server startup script and off we go. The trouble is I can’t really leave the PuTTY window running. Just in case the boss wanders over and looks closely enough to read the text. But if I close the PuTTY window the server dies as well.

The screen utility is the solution. It lets you start the server and leave it running while you close PuTTY. Later on, you reconnect to the server and the Minecraft game.

The office Ubuntu documentation is on the Ubuntu Community site, but here’s my guide.

  1. Start the server and connect via PuTTY in the normal way
  2. Type screen and then press enter
  3. The terminal will return to normal. This might be disconcerting but, don’t worry, it’s running in the background.
  4. Start your server in the normal way.
  5. Once it’s all running well, press Ctrl+a and then d. This will detach the screen app and return you to the normal terminal. As you can tell from the lack of angry shouting, the server is still running.
  6. At this point you can close the PuTTY session (and get on with some work if you feel so inclined).

Getting back on the server (because let’s face it, at some point someone is going to empty a bucket of lava over someone else) is straightforward.

Connect to the server again and type screen -r to restart screen with the last session. At this point you’ll see the Minecraft server text again, just as you left it!

Advanced

You can use screen with more than one screen. For example there’s rarely opportunity to say “Hang on, I’ll start the server in a mo, just got to run some updates”. This can end up with a screen full of different PuTTY windows.

  1. Connect to your server, type screen, press Enter and then Enter again
  2. Start your Minecraft server
  3. Press Ctrl+a and then c to create a new screen
  4. Start updates or different server.
  5. Repeat from 3 as required

Now you have lots of screen consoles, the challenge is to find them again. Press Ctrl+a and n or p to move to the next or previous screen. If that’s not enough press Ctrl+a then to show a list of all the consoles in screen. Use the up and down arrows to pick a screen and press Enter to switch to it.

This could get a little confusing after a while but the clever people behind screen have thought of this – you can name screens! Press Ctrl+a then A, enter a name for the screen and press Enter.

screen-selection-screen

Use the arrow keys to move up and down or press a number to select a screen

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s