this post was submitted on 16 Dec 2025
44 points (94.0% liked)
Linux
14476 readers
508 users here now
A community for everything relating to the GNU/Linux operating system (except the memes!)
Also, check out:
Original icon base courtesy of lewing@isc.tamu.edu and The GIMP
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I have a script named
din my PATH and it contains this:It allows me to run any program in a fully detached state in a way that works even if the terminal that started the program closes, and it's as simple as
d <command>.Shouldn't you end with
& disownto fully detach?IIRC
disownis a shell built-in command, so its use is a bit limited. Not sure if&is also a built-in, but I founddisownto not work in some situations. Besides, it's shorter.After looking into it a bit more, its at least a builtin for
bashbut is otherwise not POSIX. I guessnohup ... &would be the POSIX compliant equivalent, though still not a builtin.Its my understanding that
&backgrounds, not necessarily detaches, a process -- if the parent process closes, I think the background tasks would still bewait()ed on, if only using&.