Don’t Let Applications Close When The Terminal Is Closed

You may have started an application from the terminal and noticed that those applications close when the terminal is closed. This article will help you stop that behavior. This should be a pretty basic and speedy article.

Let’s explain what I mean with a demonstration. First, open your terminal by pressing CTRL + ALT + T. Now, enter the following:

Change the ‘pcmanfm-qt’ to the file manager you use, like ‘nemo’, ‘spacefm‘, or whatever it is you use to manage files in a graphical way. Any one will do. 

Now, close the terminal that you used to open your file manager or application. When you do so, you’ll see that applications close when the terminal is closed. Well, it doesn’t have to be that way. 

Enter ‘nohup‘, a lovely tool that will let you open applications in the terminal and then make sure that those applications don’t close when the terminal is closed. The ‘nohup’ application should be installed by default on any major distro and the man page describes it like:

nohup – run a command immune to hangups, with output to a non-tty

If you check the man page, you’ll see that it has pretty much no useful flags other than help and version. So, straight away you’ll see that it’s a pretty easy application to work with.

And, with that ease in mind, I’m just gonna go straight into telling you how to use it.

Applications Close When The Terminal Is Closed:

Seeing as you already opened the terminal, let’s not mess about and just show you some uses of ‘nohup’. Let’s say you use ‘nemo’ as your file manager:

Now close the terminal. See? When you use ‘nohup’ you’ll not have applications close when the terminal is closed.

You may see the command used with an ampersand (“&”) symbol at various tutorial sites. What that does is it runs things in the background. This means it should immediately return to the command prompt after the application has opened. This only works if you’re using bash, by the way. If you use it, it looks something like this:

Anyhow, after you’ve used ‘nohup’ to open an application without the ampersand, you can also just press CTRL + C and disconnect the running application from the terminal while returning you to the command prompt. Later, when you close the terminal, you’ll find see that no longer do those applications close when the terminal is closed.

That’s about it, really. I don’t see any reason to stretch this article out by adding fluff. You’re welcome!

Closure:

There ya have it. Another article. This one will help you change the behavior, if you don’t want to have applications close when the terminal is closed. 

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe to Newsletter!
Get notified when new articles are published!
We promise to never share your email!
icon

Author: KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

2 thoughts on “Don’t Let Applications Close When The Terminal Is Closed”

Leave a Reply

Your email address will not be published. Required fields are marked *

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.