0

I'm running command xxx xxx in linux, and I want to redirect all output, including std/warn/err output into one file IN ORDER.

How to deal with this?

For example, if I run command xxx xxx 2>file, the file will only contains error message. If I run command xxx xxx 1>file, the file will only contains std message. But I want all message together, not devided message. How to deal with this?

Thank you!

batmancn
  • 457
  • 3
  • 15
  • Possible duplicate of [How can I redirect and append both stdout and stderr to a file with Bash?](https://stackoverflow.com/questions/876239/how-can-i-redirect-and-append-both-stdout-and-stderr-to-a-file-with-bash) – P.... Jun 06 '17 at 08:21

2 Answers2

1

I think you are looking for this:

command >outfile 2>&1.
Kent
  • 189,393
  • 32
  • 233
  • 301
0

You could also use this simpler way

$ command arg1 arg2 >& command.out

This is typical C shell way but works well on most advanced shells such as bash.

asatsi
  • 452
  • 2
  • 5