I'm trying to launch a program from the Terminal in such a way that the following occurs:

  1. Closing the Terminal does not close the program
  2. The program is not outputting anything to the Terminal while opening, using, or closing
  3. The Terminal is free to be used for other things
  4. The command is short and sweet
  5. There is no output file to worry about
  • 2
    Like always, if you find yourself frequently typing something long, make a shortcut for it using an alias, or a shell function when an alias won't do the trick. Commented Apr 16, 2015 at 8:31
  • Try screen -mdS xyz <command> &.
    – Pandya
    Commented Apr 16, 2015 at 15:17

6 Answers 6


See man nohup:

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


nohup program-name &
  • 2
    Almost what I'm looking for. But, it still outputs to the screen when the program is opened and closed: [1]+ Done nohup google-chrome
    – Evan
    Commented Apr 16, 2015 at 2:00
  • @Evan , yes, you will get these messages, and i don't think there's any way around it, but otherwise it's the best way to separate terminal and the program, and it will be immune to closing the terminal window. Personally, I upvote this answer. Small suggestion , though, you can use nohup program-name 2> /dev/null & to also redirect errors Commented Apr 16, 2015 at 2:49
  • 1
    @Evan that's not nohup, that's bash: askubuntu.com/a/590193/158442
    – muru
    Commented Apr 16, 2015 at 8:47
  • 1
    The thing I hate about nohup: it doesn't understand aliases in zsh. Commented Apr 16, 2015 at 13:17

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 %%; }


launch_and_forget program args "args args" ...

Give a name that's meaningful for you.

  • <>/dev/null 1>&0 2>&0 is slightly shorter than </dev/null &>/dev/null and uses slightly less kernel memory.
    – kasperd
    Commented Apr 16, 2015 at 10:11

You can very simply use setsid:-

       setsid - run a program in a new session

       setsid program [arg...]

       setsid runs a program in a new session.

Try the following command:-

setsid <command>

Example:- setsid gedit, setsid nautilus ~/Downloads/ etc.

  • 1
    This seems like the best answer to me, why would one use nohup over setsid?
    – Insperatus
    Commented Apr 21, 2015 at 23:48
  • 1
    Awesome this is exactly what I was looking for!
    – Evan
    Commented Apr 23, 2015 at 0:58

Use tmux.

First launch tmux, then run whatever command you want. You can close the tmux window, or drop back by shortcut CTRL-B D. In fact, you can even later reattach by tmux attach.


I would recommend either tmux, as Siyuan Ren suggested, or GNU Screen. That way, you get a new terminal for your command. You can detach it and forget about it, but you can get back if you change your mind.


I picked up, and continue to use...

(nohup program-name 2>/dev/null &)

Not the answer you're looking for? Browse other questions tagged .