How do I convert an epoch timestamp to a human readable format on the cli?
date -r 1234567890
On Linux (specifically, with GNU coreutils ≥5.3):
date -d @1234567890
With older versions of GNU date, you can calculate the relative difference to the UTC epoch:
date -d '1970-01-01 UTC + 1234567890 seconds'
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:
perl -le 'print scalar localtime $ARGV' 1234567890
+1 for the comment about the lack of portability (why doesn't the POSIX spec include a way to do this? grr)
What does the `@` mean in `date -d @1234567890`? `man date` made no reference to that...
@ChrisMarkle GNU man pages are often woefully incomplete. “The date string format is more complex than is easily documented here but is fully described in the info documentation.” To wit: http://www.gnu.org/software/coreutils/manual/html_node/Seconds-since-the-Epoch.html#Seconds-since-the-Epoch
The `info date` is quite complete. The entry at `28.9 Seconds since the Epoch` explains in detail about the @timestamp.