Get current time in seconds since the Epoch on Linux, Bash

n-alexander picture n-alexander · Jul 7, 2009 · Viewed 554.9k times · Source

I need something simple like date, but in seconds since 1970 instead of the current date, hours, minutes, and seconds.

date doesn't seem to offer that option. Is there an easy way?

Answer

Steef picture Steef · Jul 7, 2009

This should work:

date +%s