I can understand the statements like.
bzip2 --version >/tmp/list_right 2>/tmp/list_errorbzip2 --version >/tmp/list 2>&1
But I don't understand the statement:
bzip2 --version 2>&1 < /dev/null | head -n1
2>&1 duplicates standard output as standard error. </dev/null redirects standard input to the null character special device, eof is encountered immediately when reading. |head -n1 pipes standard output to the command, thus the first line is printed, and lines after the first are discarded.
bzip2 --versionoutputs info tostderrbut pipe (|) transferstdoutonly. So in the case to be able format info (prints just 1st line) thestderrofbzip2 --versionis redirected tostdout. Is there any reason to input/dev/nullI have no idea.