My program prints out a . (without newline) every 100 ms to indicate progress. When running it on a remote machine via ssh, however, I cannot see the output before a newline is printed. I tried it on Cygwin and on Ubuntu.

Is there a way to make ssh display output before the line is complete?


The problem is usually output buffering by your program, or more accurately by an IO library or run-time that your program uses. Specifically line-buffering.

Unbuffered IO is much less efficient, which is why it is not used by default.

Programming languages often have a way of specifying unbuffered output. Since it usually depends on what STDOUT is connected to it is also affected by OS environment settings.

See also stdbuf

  • Awesome! prepending stdbuf -o 0 to the command did the trick. Thx – jederik Nov 24 '16 at 16:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.