System Management
A nightly script runs rsync and must overwrite /var/log/sync.log with everything rsync prints, both normal output and error messages, in the order it was produced. Which command does this?
Show the answer
Correct answerA. rsync -a /data /mnt/backup > /var/log/sync.log 2>&1
Redirecting stdout to the file first and then duplicating stderr onto it with 2>&1 sends both streams to the file. Reversing the order sends stderr to the terminal, because 2>&1 copies stdout's destination at that moment, before the file redirect is applied.