If I follow a file somehow like this:tail -f  /var/log/syslog|grep sI see all lines containing an sWhy does this not give any output, if I grep it again to the same s?tail -f  /var/log/syslog|grep s|grep s
double grep on tail -f gives no output
grep;io redirection;output
As Rubo77 mentioned, the issue is solved by adding the --line-buffered to the first grep command:tail -f  /var/log/syslog|grep --line-buffered s|grep sHowever, you then may ask, why isn't this needed for a single grep command?  The difference between the two is that in the following command:tail -f  /var/log/syslog|grep sSTDOUT for grep is pointed to a terminal.  grep most likely writes to STDOUT via functions contained in the stdio library.  Per the documentation (stdio(3)):Output streams that refer to terminal devices are always line buffered by default;Thus, the underlying library calls are flushing the buffer after each line without any action on grep's part.In this command:tail -f  /var/log/syslog|grep --line-buffered s|grep sSTDIO is now going to a pipe rather than a terminal device and the library functions that grep is using to write to STDOUT fully buffers these writes rather than using line buffering.  When the --line-buffered flag is used, grep will call fflush, which will flush all of the buffered write.