I was finding a way to save all output to a file and print it.
And the command like the following does work perfectly!
ls "*" 2>&1 | tee ls.txt
But I think I don't understand it well.
And I tried ls "*" | tee ls.txt
. It doesn't work. The error message was not saved into ls.txt
.
Also I tried ls "*" 1>&2 | tee ls.txt
. It behaved some strange. What happened?