So if I enter the command$ gzip --version | head -n1everything goes as expected. But if I try the same with bzip2:$ bzip2 --version | head -n1I get a lot of lines and I have to press Ctrl-C to terminate.What is happening here?EDIT:The lines being printed by $ bzip2 --version | head -n1bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010.Copyright (C) 1996-2010 by Julian Seward.This program is free software; you can redistribute it and/or modifyit under the terms set out in the LICENSE file, which is includedin the bzip2-1.0.6 source distribution.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theLICENSE file for more details.and i have to press Ctrl-C to continue.If I omit the pipe I get$ bzip2 --version bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010.Copyright (C) 1996-2010 by Julian Seward.This program is free software; you can redistribute it and/or modifyit under the terms set out in the LICENSE file, which is includedin the bzip2-1.0.6 source distribution.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theLICENSE file for more details.bzip2: I won't write compressed data to a terminal.bzip2: For help, type: `bzip2 --help'.If I merge stdout with stderr as @devnull sais, it displays the lines well, but i need to press Ctrl-C. I tried $ gcc 2>&1 | head -n1and it works well, so I think there is something still missing in the bzip2 command. EDIT 2: I solved the issue with the following command:$ bzip2 --version 2>&1 < /dev/null | head -n1 But I still don't understand the problem.
Why bzip2 --version behaves strange?
io redirection;bzip2