In this short article, we would like to show how to print unix time in milliseconds in Unix / Linux terminal.
This section shows alternative solutions.
date +%s%N | cut -b 1-13 # or echo $(($(date +%s%N) / 1000000))
Note: the first of the solutions above is not perfect as we have extracted
1-13numbers which will change in the long term due to the increasing number representing time.
Some linux distributions and Unix based operating systems like OS X could do not upport
%N, so it can be necessary to use other solution to get it. Below description shows how to do it with different techniques.
Example time source for