TS(1)

NAME
ts - timestamp input

SYNOPSIS
ts [-i | -s] [-m] [format]

DESCRIPTION
The ts utility prepends a timestamp to each line of standard input and writes it to standard output.

The options are as follows:

-i  Display time elapsed since the last timestamp.

-m  Display timestamps derived from a strictly linearly increasing clock. Without -m, timestamps reflect the current date and time, including time jumps if the system time is changed.

-s  Display time elapsed since the start of the program.

The optional format argument controls how the timestamp is displayed, according to the conversion specifications described in the strftime(3) manual page. The default format is "%b %d %H:%M:%S"; or "%H:%M:%S" if one of the -i or -s options is used.

Some additional conversion specifications are also supported to append microsecond resolution: %.S, %.s, and %.T; which are similar to %S, %s, and %T. Examples: "10.00001", "1656427781.00001", and "4:20:00.00001".

EXAMPLES

    $ (echo foo; sleep 2; echo bar) | ts
    Jun 28 12:13:38 foo
    Jun 28 12:13:40 bar
    $ ls | ts -i %.S
    00.000452 CVS
    00.000595 Makefile
    00.000004 ts.1
    00.000004 ts.c

SEE ALSO
strftime(3)

HISTORY
A ts utility first appeared in the moreutils collection by Joey Hess, and was rewritten from scratch for OpenBSD 7.2.

AUTHORS
This ts utility was written by Job Snijders <job@openbsd.org> and Claudio Jeker <claudio@openbsd.org>.