I'm trying to run a minecraft server on linux. Running the server starts an important interactive session. I can run the server in the background by appending & at the end of the command and log off the server. But then I don't know how to get back to that interactive session when I log back in.

I know about screen, but it seems like there should be a better way of running processes in the background and being able to go into them later.

migrated from serverfault.com Nov 20 '12 at 12:26

This question came from our site for system and network administrators.

  • @SvenW if you make that comment into a answer I'll credit you – at. Nov 27 '12 at 16:33

screen (or tmux) is the best option for this and written for exactly this purpose.

  • Or dtach. (See questions tagged with dtach). – manatwork Nov 27 '12 at 16:50

This is the proper way to do it:

  • Start the process without the &
  • Use Ctrl-Z to suspend the process
  • Execute on that command line the process bg. This will take your process to the background as if you had it executed using the &.
  • At any point in time you can bring your process to the foreground by using fg
  • Also, you can get a list of currently executing processes by executing jobs
  • Sounds perfect, can I log out of the ssh session while a process is bg'ed and then log back in and fg into it? – at. Nov 25 '12 at 9:19
  • no, you can't. To achieve that, as already stated by SvenW, you should use screen or tmux. – Gonzalo Alvarez Nov 27 '12 at 10:54

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.