Home > Enterprise >  get time in millisecond in find command linux
get time in millisecond in find command linux

Time:11-29

I am executing following command of find in linux. find /Volumes/app -user john -mtime 60. It gives the list of file modified.

After adding -printf '%TY %Tb %Td %TH:%TM %p\n' in find command in gives list of files with date.

Following is the output:

2022 Nov 28 19:05 .
2022 Nov 28 18:31 ./abc.py

But instead of date How to get time in milliseconds?

CodePudding user response:

date %s%N returns the number of seconds current nanoseconds.

Try this

-printf $(($(date %s%N)/1000000))

date %s returns the number of seconds since the epoch, if that's useful.

CodePudding user response:

This gives time in nano-seconds by GNU find :

find . -printf '%TY %Tb %Td .%TT %p\n'
  • Related