Most efficient way of launching and separating a program from the terminal? [duplicate]
See man nohup
:
NAME
nohup - run a command immune to hangups, with output to a non-tty
Answer:
nohup program-name &
I think this would be the most complete way:
program-name </dev/null &>/dev/null &
disown %%
Disowning the backgrounded process means the shell won't track it anymore. It won't tell you when it's done. It won't prevent you from closing your shell. %%
means "the most recently backgrounded job".
If you want to hide all the details, put a function like this in your .bashrc
launch_and_forget () { "$@" </dev/null &>/dev/null & disown %%; }
Then
launch_and_forget program args "args args" ...
Give a name that's meaningful for you.
You can very simply use setsid
:-
NAME
setsid - run a program in a new session
SYNOPSIS
setsid program [arg...]
DESCRIPTION
setsid runs a program in a new session.
Try the following command:-
setsid <command>
Example:- setsid gedit
, setsid nautilus ~/Downloads/
etc.