oynjxq
Last Updated: February 25, 2016
·
1.145K
· bartlomiejdanek
Bard2

Execute unix shell command in background

It might be helpful when you don't need output, example with ls command:

ls > /dev/null 2>&1 &
Say Thanks
Respond

5 Responses
Add your response

3109
E48ebcddacc8bd74baf1d37c62f7845a

To execute that command in the background you're missing an & at the end. Or the name of the submission is wrong and you wanted to execute it while suppressing any output.

over 1 year ago ·
3117
Bard2

thanks @mhitza, fixed!

over 1 year ago ·
3299
Profile pic2

It's also useful while working with cron.

over 1 year ago ·
15697
9582a1e999527bea2c2fa342dceb03d0

Sometimes its nice to do it without the stderr redirection (the 2>&1 part) and still see problems while its running. Even if its forked stderr will show in your shell. Same for cron, you wont loose those messages (will be in log).

over 1 year ago ·
17613
6f71feda9fa840308788fde9a6235bcf

If you combine it with nohup or screen, you can even log out without the program being terminated.
http://en.wikipedia.org/wiki/Nohup
http://en.wikipedia.org/wiki/GNU_Screen

over 1 year ago ·
Filed Under