date +"%T.%N"
returns the current time with nanoseconds.
06:46:41.431857000
date +"%T.%6N"
returns the current time with nanoseconds rounded to the first 6 digits, which is microseconds.
06:47:07.183172
date +"%T.%3N"
returns the current time with nanoseconds rounded to the first 3 digits, which is milliseconds.
06:47:42.773
In general, every field of the date
command's format can be given an optional field width.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…