Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running a Minecraft server on Fedora 15. I have openssh-server installed on the server and I can connect to it just fine.

Right now, the Minecraft server software opens into a terminal when the user logs in. The server software has a console that accepts commands and prints status updates and stuff like that. I am wondering if there is a way that I can access that already-running server console remotely over SSH.

share|improve this question
    
Heh. Looks like everyone loves screen. I think Dolda2000 was first. –  Paul Sep 30 '11 at 2:05
add comment

4 Answers

up vote 2 down vote accepted

Use screen. You'll find it in the package manager.

So start a screen session, then start the minecraft server.

Next time you ssh to the box, you can screen -r and it will bring the session back.

share|improve this answer
    
Is there any way that I can detach a screen session running locally on the machine while I am using ssh? –  Genre Sep 30 '11 at 2:40
2  
If you have a prompt, you can type screen -d. If you are running something, you can type ctrl-a-d. Also, just ending your ssh session will leave the screen session running in a detached state. If you use linux command line more than a little, you really want to get into using screen. It will make you happy. Look online for .screenrc examples. screen can run multple concurrent bash shells that you can switch between, which saves running multiple ssh sessions - and they all survive a logout-login. –  Paul Sep 30 '11 at 4:01
add comment

If the server is a command line program, consider running it in a screen session.

e.g.:

$ screen
$ minecraft-server-program

Then press Ctrl-A-D to detach from the session. From an ssh session, type in screen -r to resume the screen session.

share|improve this answer
add comment

Start it in an instance of GNU screen. screen is basically a terminal multiplexer, which maintains one or several virtual terminals that you can switch between, and the whole set of virtual terminals can be reattached in a new login.

share|improve this answer
add comment

I'm here to provide an alternative!

Use tmux.

Install it with yum install tmux.

Like screen, run your server after starting a new tmux session like so.

$ tmux
$ ./minecraftserver

The prefix key for tmux is CTRL-B. After starting your Minecraft server, you can detach from the current session with CTRL-B, D. Your Minecraft server will continue to run in the tmux session.

To attach back into the tmux session, type tmux att from your normal shell.

If you have more than one tmux sessions open, type tmux list-sessions, which will give you something like this.

[jin@encrypt ~] % tmux list-sessions
0: 1 windows (created Fri Sep 30 10:24:23 2011) [179x43]
1: 1 windows (created Fri Sep 30 10:28:29 2011) [179x43]

If you want to go back to the second session, type tmux att -t 1.

For more commands and configuration options, see here.

share|improve this answer
    
While this isn't really a place for chatting - do you know the pros and cons versus screen? Ctrl-b is one already, but I could always remap ctrl-a in screen if it bothered me enough. –  Paul Sep 30 '11 at 4:03
    
@Paul Why does it bother you? I've actually remapped tmux's prefix key from b to a. Anyway, you can check out this Unix.SE question for the comparison. unix.stackexchange.com/questions/549/tmux-vs-gnu-screen –  Jin Sep 30 '11 at 5:34
    
Some of the console apps I use from time to time need ctrl-a - but not frequently enough to make it worthwhile, I just work around it normally. –  Paul Sep 30 '11 at 6:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.