stderr To Stdout (2>&1)
Use
command >log.txt 2>&1
What It Does
2>&1 sends stderr to the same destination stdout uses at that moment.
Order Matters
command >combined.log 2>&1
This sends stdout to combined.log, then sends stderr there too.
command 2>&1 >stdout.log
This sends stderr to the old stdout first, then redirects stdout. The result is different.
Docs Pointers
- Read stderr redirection, I/O, file descriptors, and stream redirection.

Linux Foundations