Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In order to run a game server (minecraft) I start it by running this command in CentOS:

java -Xms512M -Xmx1G -jar minecraft_server.jar

But I have no idea how to stop this file from running. I assume it has it's own internal command but considering it might be started in background and running for a very long time, how can I stop this Java command?

Thank you.

share|improve this question
up vote 1 down vote accepted

You can use a combination of ps and kill to stop the particular process.

You would first do ps -aux | grep minecraft to get the process number - which is the second field, first number.

Then you can issue kill $PID to send SIGTERM to the process and have it gracefully shutdown.

share|improve this answer
deleting mine, yours looks nicer (yes, I know about a non drastic kill, was just being quick). – mdpc Dec 18 '12 at 20:41
Then check, and if that doesn't stop the process then enter kill -9 $PID. – mdpc Dec 18 '12 at 20:42
That does the job. Thank you. – adrianTNT Dec 19 '12 at 19:26

Your Answer


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.