I am using the tee command to output the compilation errors of a program into a file along with the terminal.gcc hello.c | tee file.txt This is the command I have used. The compilation errors are displayed on the terminal but they are not outputted in the file. How should I output the std errors into file?
Output Redirection
command line;pipe;io redirection;tee
With csh, tcsh, zsh or recent versions of bash, trygcc hello.c |& tee file.txtwhere|& instruct the shell to redirect standard error to standard output.In other Bourne-like shells:gcc hello.c 2>&1 | tee file.txtIn rc-like shells:gcc hello.c >[2=1] | tee file.txtIn the fish shell:gcc hello.c ^&1 | tee file.txt