Search code examples
bashshellbackground-process

bash: hit return once, run 2 commands in the background


Rather than this:

$ command1 & 
$ command2 & 
$ …

Is there a way to do the equivalent in bash, but on a single line of input?


Solution

  • & is a command terminator, just like ;. You can include multiple commands on one line.

    $ command1 & command2 &
    $