Programming Tips - bash: How can I get the milliseconds since the start of the epoch

Date: 2017may10 OS: Linux Language: bash Q. bash: How can I get the milliseconds since the start of the epoch A. Use the + option of the date command.
%s is the seconds %N is the nanoseconds %3N is the first 3 digits of the nanoseconds (doesn't work on all systems)
So:
date '+%s%3N' If %3N works for you
Otherwise:
$(( $(date +%s%N) / 1000000 ))
By the way, to get the seconds since the start of the epoch (January 1, 1970):
date '+%s'