Linux Fundamentals - Understanding epoch time

by
Jeremy Canfield |
Updated: October 06 2023
| Linux Fundamentals articles
On a Linux system, epoch is the number of seconds that have elapsed since January 1st, 1970.
The date command with the %s option can be used to display the current epoch time. In this example, 1643368599 seconds have elapsed since January 1st, 1970.
~]$ date +%s
1643368599
And here is how you could convert an epoch time to human readable date time.
~]$ date -d @1655380828
Thu Jun 16 07:00:28 CDT 2022
Or, you can also use echo or printf.
~]$ echo $(date +%s)
1643368599
And here is how you could convert an epoch time to human readable date time.
~]$ echo $(date -d @1655380828)
Thu Jun 16 07:00:28 CDT 2022
Often you'll want to return the result in UTC.
~]$ echo $(date -d @1655380828 --utc)
Thu Jun 16 12:00:28 UTC 2022
Did you find this article helpful?
If so, consider buying me a coffee over at