Nguyễn Đôn Hào
New member
How do I redirect standard error in bash?
Answer
2> is input redirection symbol and syntax is:
Answer
2> is input redirection symbol and syntax is:
- To redirect stderr (standard error) to a file: command 2> errors.txt.
- Let us redirect both stderr and stdout (standard output): command &> output.txt.
- Finally, we can redirect stdout to a file named myoutput.txt, and then redirect stderr to stdout using 2>&1 (errors.txt):