On linux there is a great command line program ts. It adds a timestamp to the beginning of each line of input.

Here is an example (on some linux machine):

root@227ee318bbc1:~# echo -e '1\n2\n3'
root@227ee318bbc1:~# echo -e '1\n2\n3' | ts
Apr 19 18:59:52 1
Apr 19 18:59:52 2
Apr 19 18:59:52 3

But there is no such program on my mac:

bessarabov@air:~$ echo -e '1\n2\n3' | ts
-bash: ts: command not found

And there is no program with such name in brew.

How can I get ts program on my mac?

  • Seems to be rather easy to solve with a shell script :-) What does file $(type -p ts) return on your Linux system? – nohillside Apr 19 '18 at 19:43

Try brew install moreutils and then run the ts command. moreutils installs a bunch of things.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .