launching a task from cli and "divorcing it from terminal task
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
launching a task from cli and "divorcing it from terminal task
How do you launch a task from a terminal command line interface and it not be kill'ed if you close the terminal window.
Like if I run jedit I type
jedit &
which launches jedit as a backgorund task. But, if I close terminal window, jedit dies to. How do I laucnch jedit and completely divorce it from the terminal task?
Bash also has a disown builtin command that lets you detach a process after you've launched it. ctrl+z to pause the process, then run bg to send it to the background, and finally run disown, and it will be "forgotten" by the shell.
If you want to be able to detach a process and re-attach to it later, consider using screen.
nohup worked as suggested with jedit.
Had to try another app to disown since jedit automatically placed itself in background. But, worked as stated on another app.
You can get a list of all background processes running in a shell with the jobs command. Then you can address any of those jobs with disown %n, "n" being the number of the job you want. Or use disown -a to detach all of them.
Check out help disown or the SHELL BUILTIN COMMANDS section of the bash man page, and read up on job control.
Last edited by David the H.; 02-11-2011 at 11:42 AM.
Reason: 1. minor correction 2. re-link to up-to-date page
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.