Timestamp your bash output
If you need to find out the time difference between bash outputs, you can use ts
from the moreutils package.
To get started, you’ll need to install moreutils
.
A simple apt-get install moreutils
should do the trick.
Then all you need to do is to pipe your output to ts
Like:
echo -e "test\ntest\ntest" | ts
This will return a nice timestamp on each linebreak.
You can even customize the timestamp like:
echo -e "foo\nbar\nbaz" | ts '[%Y-%m-%d %H:%M:%S]'
[2011-12-13 22:07:03] foo
[2011-12-13 22:07:03] bar
[2011-12-13 22:07:03] baz
References: