How do I convert an epoch timestamp to a human readable format on the cli? I think there's a way to do it with date but the syntax eludes me (other ways welcome).
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
On *BSD:
On Linux (specifically, with GNU coreutils ≥5.3:
With older versions of GNU date:
If you need portability, you're out of luck. The only time you can format with a POSIX shell command (without doing the calculation yourself) line is the current time. In practice, Perl is often available:
|
|||||||||
|
|
|
|||||
|
This can come in handy for those applications which use epoch time in the logfiles:
|
|||
|
|
|
The two I frequently use are:
and
|
|||
|
|