unix get epoch in miliseconds shell

C++
date +"%T.%6N" # returns the current time with nanoseconds rounded to the first 6 digits, which is microseconds
# In general, every field of the `date` command's format can be given an optional field width..
Source

Also in C++: