Get current time in seconds since the Epoch on Linux, Bash
This should work:
date +%s
Just to add.
Get the seconds since epoch(Jan 1 1970) for any given date(e.g Oct 21 1973).
date -d "Oct 21 1973" +%s
Convert the number of seconds back to date
date --date @120024000
The command date
is pretty versatile. Another cool thing you can do with date(shamelessly copied from date --help
).
Show the local time for 9AM next Friday on the west coast of the US
date --date='TZ="America/Los_Angeles" 09:00 next Fri'
Better yet, take some time to read the man page http://man7.org/linux/man-pages/man1/date.1.html