How to get the epoch timestamp in Bash?

Posted on In QA

In Bash, how to get the epoch timestamp, the number of seconds passed since the epoch?

In Bash, you can call the date command with format option “+%s”:

date +%s

Here, “%s” means:


seconds since 1970-01-01 00:00:00 UTC

Leave a Reply

Your email address will not be published. Required fields are marked *