batmancn
batmancn

Reputation: 477

how to redirect `command ...` all output into a file in linux?

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!

Upvotes: 0

Views: 154

Answers (2)

asatsi
asatsi

Reputation: 472

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.

Upvotes: 0

Kent
Kent

Reputation: 195289

I think you are looking for this:

command >outfile 2>&1.

Upvotes: 1

Related Questions