Getting the timestamp from the command line

31 Aug 2007


date +%s

I just saved you looking at a minimum of three man pages.

While we are on the topic, here's how to do simple timings. Yes I know about time but sometimes that's not quite what you want.

$ TIME_START=`date +%s`
$ #... stuff
# TIME_END=`date +%s`
# echo "It took `expr $TIME_END - $TIME_START` seconds."