> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Add timestamp on each line of bash output
- URL: https://www.bagz.fr/add-timestamp-on-each-line-of-bash-output/
- Published: 2019-07-17T09:55:34.000Z
- Updated: 2019-07-17T09:55:34.000Z
- Author: bgazui
- Tags: Linux, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

When analyzing the output of a bash script, it can be useful to prepend timestamp before each line to see how long it's taking to do a specific action.

For this, you can use the '*ts*' command:

\# echo -e "this\\nis\\na\\ntest" | ts '\[%Y-%m-%d %H:%M:%S\]'  
\[2019-05-13 09:14:28\] this  
\[2019-05-13 09:14:28\] is  
\[2019-05-13 09:14:28\] a  
\[2019-05-13 09:14:28\] test

If the command '*ts*' is not available, you might need to install the package **moreutils**.