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?
teeonly redirects stdout, compilation errors are presumably being output to stderr. See this post for more info on redirecting stderr withtee