I'm a Linux n00b, but it's something I'm really trying to learn.

Let's say I log in to my server at home directly and start a process. For the sake of specificity, it's a CraftBukkit Minecraft server. :)

There were some issues and now I want to restart the game server remotely. How can I log in and up that terminal session that is running the server?

I can access the computer through remote desktop. I can set up SSH if necessary.


  • Shouldn't the title be "Accessing running terminal sessions" ?
    – jmbouffard
    Jul 12 '11 at 18:31
  • I suppose it should. I'm not sure how to edit the title.
    – Jesse
    Jul 12 '11 at 19:13

You cannot log remotely to a terminal that is already running on the machine.

Instead, use ssh to log to the system, it is installed by default on most distribution. Then, after login through ssh, you can kill the running server by using (let's say the executable is CraftBukkit)

> killall CraftBukkit

You can confirm the name of the running process to kill by looking at the process list shown by typing

> ps aux

Next, you can restart the server by calling the command line but add the "screen" command in front. Running the server inside a screen session enables you to always reconnect to the session from anywhere by doing

> screen CraftBukkit param1 param2 ...
// use CTRL-a then d to detach session
> screen -r // will reattach session

If screen is not available on the system install it with

sudo apt-get install screen
  • I installed screen. I use a startup script to start the server "~/minecraft/minecraft.sh". So, if I used screen to start the server I would do: "screen mc ~/minecraft/minecraft.sh" and that would create a screen session called "mc" yes?
    – Jesse
    Jul 12 '11 at 19:15
  • If you want to set a session name use the parameter "-S sessionname"
    – jmbouffard
    Jul 12 '11 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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