Forrest logo
back to the ${command} tool

ts:tldr:1e85e

ts: Add [i]ncremental timestamps with microsecond precision, starting from zero.
$ ${command} | ts -i "${%H:%M:%-S}"
try on your machine

This command is a combination of two commands along with a pipe ('|') to redirect the output from one command to another.

  1. ${command}: It represents a placeholder for an actual command. You need to replace ${command} with the desired command that you want to execute. For example, if you want to execute the command ls -l, you would replace ${command} with ls -l.

  2. |: It is called a pipe and it redirects the output of the preceding command to the input of the following command. In this case, it redirects the output of ${command} to the input of the next command, which is ts -i "${%H:%M:%-S}".

  3. ts: It is a command used to prepend timestamp information to each line of text from its input stream. It stands for "timestamp".

  4. -i "${%H:%M:%-S}": It is an option used with the ts command to specify the format of the timestamp to be prepended to each line. Here, it uses a placeholder ${%H:%M:%-S} to represent the desired timestamp format.

Let's break down the timestamp format ${%H:%M:%-S}:

  • %H: Represents the hours in 24-hour format (e.g., 01, 13, etc.)
  • %M: Represents the minutes (e.g., 05, 35, etc.)
  • %-S: Represents the seconds (e.g., 08, 54, etc.). The - before S is used to remove any leading zero from the seconds.

Putting it all together, this command executes ${command}, captures its output, and then uses the ts command to prepend each line of output with a timestamp in the specified format.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ${command} tool