The date command is able to convert epoch time to human readable time.
So if the epoch time is 1311252510, to convert it, you can use the command below.
date –date “$[$(date ‘+%s’)-1311252510] seconds ago” ‘+%m/%d/%Y %H:%M:%S’
You can also use it in a script as follows:
#!/usr/bin/bash
EPOCH=”$1″
date –date “$[$(date ‘+%s’)-${EPOCH}] seconds ago” ‘+%m/%d/%Y %H:%M:%S’
Then when you call the script, you can pass the epoch time to it as an argument like this:
./epoch_converter.sh 1311252510
The resulting output is:
07/21/2011 08:48:30