What do you use to forward errors to a file?
-
&> filename
-
1> filename
-
2> /dev/null
-
2> filename
D
Correct answer
Explanation
In shell redirection, file descriptor 2 represents stderr (standard error), so 2> filename redirects error messages to the specified file. Option A's &> redirects both stdout and stderr together, while option B's 1> only redirects stdout. Option C redirects errors to /dev/null, discarding them rather than saving to a file.