Linux: Stop Programs Quitting When the Terminal Is Closed

Linux: Stop Programs Quitting When the Terminal Is Closed

To prevent programs from quitting when the terminal is closed in Linux, you can use the nohup command. This command allows you to run a program in the background, even after you log out of the system.

For example, to run the program myprogram in the background using nohup, you would run the following command:

refer ‮ttual:ot‬uri.com
nohup myprogram &

The & at the end of the command is used to run the program in the background. You can then log out of the system without interrupting the program.

Alternatively, you can use the screen command to run programs in the background. This command allows you to create a "virtual" terminal session, where you can run programs and interact with them even after you log out of the system. To use screen, you would first run the screen command to start a new session, then run the program you want to keep running in the background. When you are done, you can use the detach command to detach from the screen session, which will leave the program running in the background.

Created Time:2017-10-16 14:38:53  Author:lautturi