ts
Quick Reference
Command Name:
ts
Category:
text processing
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
Syntax
ts [options] [format]
Options
| Option | Description |
|---|---|
-r, --reference=FILE |
Use FILE's timestamp as the time of the first line of input |
-s, --set=STRING |
Set time described by STRING (e.g., '2012-11-01 21:41:34') |
-i, --incremental-only |
Don't print absolute timestamps, only the delta with previous line |
-m, --milliseconds |
Include milliseconds in timestamp |
--help |
Display help and exit |
--version |
Output version information and exit |
Format String: You can specify a custom format string according to strftime(3) format. For example:
%H:%M:%S- Hours:Minutes:Seconds%Y-%m-%d %H:%M:%S- Year-Month-Day Hours:Minutes:Seconds[%Y-%m-%d %H:%M:%S]- Bracketed timestamp
Examples
How to Use These Examples
The examples below show common ways to use the ts command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
command | ts
command | ts '%Y-%m-%d %H:%M:%S'
command | ts -m
Advanced Examples:
ping -c 5 google.com | ts
command | ts > timestamped_log.txt
command | ts -m '%H:%M:%S'