Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Assuming these commands run in parallel, it is not safe. Commented Sep 20, 2020 at 8:01
  • 1
    To prevent data loss you can use the "append" (-a) option of tee, but this will not guarantee that the outputs will not be garbled (=not intermixed) in the output file. Commented Sep 20, 2020 at 8:08
  • @FedonKadifeli , Yes these commands run in parallel. I missed to add -a option in the question. i have edited the question now, please check edit. Commented Sep 20, 2020 at 11:33
  • I think there is a possibility that you can lose data. See also this: stackoverflow.com/questions/7842511 Commented Sep 20, 2020 at 11:56
  • I would prefer something like: { cmd1 & cmd2 & cmd3 & } | tee /tmp/file. I think that this version will never lose data.. Commented Sep 20, 2020 at 13:36