Last Updated: May 15, 2019
·
1.239K
· bartlomiejdanek

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 &

4 Responses
Add your response

thanks @mhitza, fixed!

over 1 year ago ·

It's also useful while working with cron.

over 1 year ago ·

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 ·

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 ·