2

Say I run an app from a terminal, but in some cases I want to close the terminal but hope the app keeps running.

Is there anyway to do so in Linux?

I just found that when calling an app via "exec APP", either would be closed if the other was closed.

Lagrange
  • 183

2 Answers2

3

Start the application with:

nohup your_application &

It will continue running after you exit the terminal.

If you use tmux or screen and start the your_application from inside that, you can reattach to the "output" after closing the terminal and opening another.

Zelda
  • 6,262
  • 1
  • 23
  • 28
2

You can also run the app normally, then hit Ctrl+Z to pause it and run bg to background it and then exit the terminal cleanly.

Cleanly means by running exit, not clicking on the close button. If you kill the terminal in any other way, it will close the app.

This works for me on Cinnamon (and other DEs) and bash. It fails with zsh.

terdon
  • 242,166
  • Thanks, but I tried this with both zsh and bash with no success. I'm using archlinux and xfce4 if these matter. – Lagrange Jan 05 '14 at 15:34
  • 1
    @Lagrange darn, it's the second time I've posted this as an answer and it doesn't work. I've been doing this happily for ages on Debian and Mint and others and various DEs. Works on bash (not zsh) for me. Make sure you have sent the job to the background with bg after the Ctrl+Z (forgot to mention that). – terdon Jan 05 '14 at 15:49
  • cool! It works now, exactly what I want. Not for zsh, as you said, but it's no big deal. Thanks! Haven't collected my 15 reputations yet, may vote for you later. Cheers, – Lagrange Jan 05 '14 at 16:14