You are currently viewing Prefixing your commands or scripts with a timestamp

Prefixing your commands or scripts with a timestamp

When you run a command or a script that runs for a long time, it may be helpful to have all its output prefixed with a timestamp. For example, we want to change this:

foo
bar
baz

to this:

[2020-12-13 12:20:38] foo
[2020-12-13 12:21:32] bar
[2020-12-13 12:22:20] baz

Here’s how you can do it.

https://www.joyfulbikeshedding.com/blog/2020-04-26-prefixing-your-commands-or-scripts-with-a-timestamp.html

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.