github.com/gdubicki/ets@v0.2.3-0.20240420195337-e89d6a2fdbda/ets.1 (about)

     1  .Dd July 3, 2020
     2  .Dt ETS 1
     3  .Sh NAME
     4  .Nm ets
     5  .Nd command output timestamper
     6  .Sh SYNOPSIS
     7  .Nm
     8  .Op Fl s | i
     9  .Op Fl f Ar format
    10  .Op Fl u | z Ar timezone
    11  .Ar command
    12  .Op Ar arg ...
    13  .Nm
    14  .Op options
    15  .Ar shell_command
    16  .Nm
    17  .Op options
    18  .Sh DESCRIPTION
    19  .Nm
    20  prefixes each line of a command's output with a timestamp. Lines are delimited
    21  by CR, LF, or CRLF.
    22  .Pp
    23  The three forms in
    24  .Sx SYNOPSIS
    25  correspond to three command execution modes:
    26  .Bl -bullet -width ""
    27  .It
    28  If given a single command without whitespace(s), or a command and its arguments,
    29  execute the command with exec in a pty;
    30  .It
    31  If given a single command with whitespace(s), the command is treated as a shell
    32  command and executed as
    33  .Sq SHELL -c Ar shell_command Ns ,
    34  where SHELL is the current user's login shell, or sh if login shell cannot be
    35  determined;
    36  .It
    37  If given no command, output is read from stdin, and the user is responsible for
    38  piping in a command's output.
    39  .El
    40  .Pp
    41  There are three mutually exclusive timestamp modes:
    42  .Bl -bullet -width ""
    43  .It
    44  The default is absolute time mode, where timestamps from the wall clock are
    45  shown;
    46  .It
    47  .Fl s, -elapsed
    48  turns on elapsed time mode, where every timestamp is the time elapsed from the
    49  start of the command (using a monotonic clock);
    50  .It
    51  .Fl i, -incremental
    52  turns on incremental time mode, where every timestamp is the time elapsed since
    53  the last timestamp (using a monotonic clock).
    54  .El
    55  .Pp
    56  The default format of the prefixed timestamps depends on the timestamp mode
    57  active. Users may supply a custom format string with the
    58  .Fl f, -format
    59  option.
    60  .Pp
    61  The timezone for absolute timestamps can be controlled via the
    62  .Fl u, -utc
    63  and
    64  .Fl z, -timezone
    65  options. Local time is used by default.
    66  .Pp
    67  The full list of options:
    68  .Bl -tag -width -indent
    69  .It Fl s, -elapsed
    70  Run in elapsed time mode.
    71  .It Fl i, -incremental
    72  Run in incremental time mode.
    73  .It Fl f, -format Ar format
    74  Use custom
    75  .Xr strftime 3 Ns -style
    76  format string
    77  .Ar format
    78  for prefixed timestamps.
    79  .Pp
    80  The default is
    81  .Dq [%Y-%m-%d %H:%M:%S]
    82  for absolute time mode and
    83  .Dq [%H:%M:%S]
    84  for elapsed and incremental time modes.
    85  .Pp
    86  See
    87  .Sx FORMATTING DIRECTIVES
    88  for details.
    89  .It Fl u, -utc
    90  Use UTC for absolute timestamps instead of local time.
    91  .Pp
    92  This option is mutually exclusive with
    93  .Fl -z, -timezone Ns .
    94  .It Fl z, -timezone Ar timezone
    95  Use
    96  .Ar timezone
    97  for absolute timestamps instead of local time.
    98  .Ar timezone
    99  is an IANA time zone name, e.g.
   100  .Dq America/Los_Angeles Ns .
   101  .Pp
   102  This option is mutually exclusive with
   103  .Fl u, -utc Ns .
   104  .It Fl c, -color
   105  Print timestamps in color.
   106  .El
   107  .Sh FORMATTING DIRECTIVES
   108  Formatting directives largely match
   109  .Xr strftime 3 Ns 's directives
   110  on FreeBSD and macOS, with the following differences:
   111  .Bl -bullet -width ""
   112  .It
   113  Additional directives
   114  .Sy %f
   115  for microsecond and
   116  .Sy %L
   117  for millisecond are supported.
   118  .It
   119  POSIX locale extensions
   120  .Sy %E*
   121  and
   122  .Sy %O*
   123  are not supported;
   124  .It
   125  glibc extensions
   126  .Sy %-*,
   127  .Sy %_*,
   128  and
   129  .Sy %0*
   130  are not supported;
   131  .It
   132  Directives
   133  .Sy %G,
   134  .Sy %g,
   135  and
   136  .Sy %+
   137  are not supported.
   138  .El
   139  .Pp
   140  Below is the full list of supported directives:
   141  .Bl -tag -width "xxxx"
   142  .It Cm \&%A
   143  is replaced by national representation of the full weekday name.
   144  .It Cm %a
   145  is replaced by national representation of
   146  the abbreviated weekday name.
   147  .It Cm \&%B
   148  is replaced by national representation of the full month name.
   149  .It Cm %b
   150  is replaced by national representation of
   151  the abbreviated month name.
   152  .It Cm \&%C
   153  is replaced by (year / 100) as decimal number; single
   154  digits are preceded by a zero.
   155  .It Cm %c
   156  is replaced by national representation of time and date.
   157  .It Cm \&%D
   158  is equivalent to
   159  .Dq Li %m/%d/%y .
   160  .It Cm %d
   161  is replaced by the day of the month as a decimal number (01-31).
   162  .It Cm %e
   163  is replaced by the day of the month as a decimal number (1-31); single
   164  digits are preceded by a blank.
   165  .It Cm \&%F
   166  is equivalent to
   167  .Dq Li %Y-%m-%d .
   168  .It Cm \&%f
   169  is replaced by the microsecond as a decimal number (000000-999999).
   170  .It Cm \&%H
   171  is replaced by the hour (24-hour clock) as a decimal number (00-23).
   172  .It Cm %h
   173  the same as
   174  .Cm %b .
   175  .It Cm \&%I
   176  is replaced by the hour (12-hour clock) as a decimal number (01-12).
   177  .It Cm %j
   178  is replaced by the day of the year as a decimal number (001-366).
   179  .It Cm %k
   180  is replaced by the hour (24-hour clock) as a decimal number (0-23);
   181  single digits are preceded by a blank.
   182  .It Cm \&%L
   183  is replaced by the millisecond as a decimal number (000-999).
   184  .It Cm %l
   185  is replaced by the hour (12-hour clock) as a decimal number (1-12);
   186  single digits are preceded by a blank.
   187  .It Cm \&%M
   188  is replaced by the minute as a decimal number (00-59).
   189  .It Cm %m
   190  is replaced by the month as a decimal number (01-12).
   191  .It Cm %n
   192  is replaced by a newline.
   193  .It Cm %p
   194  is replaced by national representation of either
   195  "ante meridiem" (a.m.)
   196  or
   197  "post meridiem" (p.m.)
   198  as appropriate.
   199  .It Cm \&%R
   200  is equivalent to
   201  .Dq Li %H:%M .
   202  .It Cm %r
   203  is equivalent to
   204  .Dq Li %I:%M:%S %p .
   205  .It Cm \&%S
   206  is replaced by the second as a decimal number (00-60).
   207  .It Cm %s
   208  is replaced by the number of seconds since the Epoch, UTC (see
   209  .Xr mktime 3 ) .
   210  .It Cm \&%T
   211  is equivalent to
   212  .Dq Li %H:%M:%S .
   213  .It Cm %t
   214  is replaced by a tab.
   215  .It Cm \&%U
   216  is replaced by the week number of the year (Sunday as the first day of
   217  the week) as a decimal number (00-53).
   218  .It Cm %u
   219  is replaced by the weekday (Monday as the first day of the week)
   220  as a decimal number (1-7).
   221  .It Cm \&%V
   222  is replaced by the week number of the year (Monday as the first day of
   223  the week) as a decimal number (01-53).
   224  If the week containing January
   225  1 has four or more days in the new year, then it is week 1; otherwise
   226  it is the last week of the previous year, and the next week is week 1.
   227  .It Cm %v
   228  is equivalent to
   229  .Dq Li %e-%b-%Y .
   230  .It Cm \&%W
   231  is replaced by the week number of the year (Monday as the first day of
   232  the week) as a decimal number (00-53).
   233  .It Cm %w
   234  is replaced by the weekday (Sunday as the first day of the week)
   235  as a decimal number (0-6).
   236  .It Cm \&%X
   237  is replaced by national representation of the time.
   238  .It Cm %x
   239  is replaced by national representation of the date.
   240  .It Cm \&%Y
   241  is replaced by the year with century as a decimal number.
   242  .It Cm %y
   243  is replaced by the year without century as a decimal number (00-99).
   244  .It Cm \&%Z
   245  is replaced by the time zone name.
   246  .It Cm %z
   247  is replaced by the time zone offset from UTC; a leading plus sign stands for
   248  east of UTC, a minus sign for west of UTC, hours and minutes follow
   249  with two digits each and no delimiter between them (common form for
   250  RFC 822 date headers).
   251  .It Cm %%
   252  is replaced by
   253  .Ql % .
   254  .El
   255  .Sh SEE ALSO
   256  .Xr ts 1 ,
   257  .Xr strftime 3
   258  .Sh HISTORY
   259  The name
   260  .Nm
   261  comes from
   262  .Dq enhanced ts Ns ,
   263  referring to moreutils
   264  .Xr ts 1 Ns .
   265  .Sh AUTHORS
   266  .An Zhiming Wang Aq Mt i@zhimingwang.org