How can I get the timestamp of each command line in my terminal history? How can I get the timestamp of each command line in my terminal history? bash bash

How can I get the timestamp of each command line in my terminal history?


I don't think I know how to show the duration, but you can view the time you ran the command by setting the HISTTIMEFORMAT variable.

export HISTTIMEFORMAT='%F %T '

Then call your "history"

history

If you only want to see last 10 commands

history | tail

Hope this help :)


history -f is a good way to prints timestamp.