2021-08-27 04:45:15 +01:00
|
|
|
# ts
|
|
|
|
|
|
|
|
> Add timestamps to every line from standard input.
|
|
|
|
> More information: <https://joeyh.name/code/moreutils/>.
|
|
|
|
|
|
|
|
- Add a timestamp to the beginning of each line:
|
|
|
|
|
2023-05-20 03:11:11 +01:00
|
|
|
`{{command}} | ts`
|
2021-08-27 04:45:15 +01:00
|
|
|
|
|
|
|
- Add timestamps with microsecond precision:
|
|
|
|
|
2023-05-20 03:11:11 +01:00
|
|
|
`{{command}} | ts "{{%b %d %H:%M:%.S}}"`
|
2021-08-27 04:45:15 +01:00
|
|
|
|
|
|
|
- Add [i]ncremental timestamps with microsecond precision, starting from zero:
|
|
|
|
|
2023-05-20 03:11:11 +01:00
|
|
|
`{{command}} | ts -i "{{%H:%M:%.S}}"`
|
2021-08-27 04:45:15 +01:00
|
|
|
|
|
|
|
- Convert existing timestamps in a text file (eg. a log file) into [r]elative format:
|
|
|
|
|
|
|
|
`cat {{path/to/file}} | ts -r`
|