Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Prepend output with time to generate each line

To show how long it takes before showing each new line of output, use this neat command.

long_command | ts -i "%.s"


$ ./configure --prefix=/tools | ts -i %.s
0.082337 checking for a BSD-compatible install... /tools/bin/install -c
0.002841 checking whether build environment is sane... yes
0.008164 checking for a thread-safe mkdir -p... /tools/bin/mkdir -p
0.000040 checking for gawk... gawk
0.005892 checking whether make sets $(MAKE)... yes

References

Weblinks

  1. Stéphane Chazelas at https://unix.stackexchange.com/questions/391210/prepending-each-line-with-how-long-it-took-to-generate-it/391222#391222

Comments