Bonus: Redirect STDERR
Standard Error
Output stream used to display error messages.
Example
- broken bash command with a redirect into
error.logfile
Redirect STDERR
By default any error messages in STDERR are sent to the terminal window of the CLI shell.
cat non-existent-file.txtOutput:
cat: non-existent-file.txt: No such file or directoryRedirect STDERR Write
STDERR can be redirected and written, or appended to a file similar to STDOUT, by using the write file 2> and append file 2>> redirection operators.
cat non-existent-file.txt 2> cat-error.logOutput:
Redirect STDERR Append
cat different-file.txt 2>> cat-error.logOutput:
Note
You are not expected to know how to redirect STDERR in this course.

