Multiple choice technology operating systems

What do you use to forward errors to a file?

  1. &> filename

  2. 1> filename

  3. 2> /dev/null

  4. 2> filename

Reveal answer Fill a bubble to check yourself
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.