I am running the following command:
find . -atime -30
However in the output, I would like it to display the time stamp of access time. Also would like it to show the user that accessed the file if at all possible.
Can you help?
Thanks.
I am running the following command:
find . -atime -30
However in the output, I would like it to display the time stamp of access time. Also would like it to show the user that accessed the file if at all possible.
Can you help?
Thanks.
Use the printf
option of find
:
find . -atime -30 -printf '%u %Ac %p\n'
Take a look at man find
for the different printf
formatting options.
find . -atime -30 -print0 | xargs -0 ls -lud
You can't determine who accessed the file, this information is not generally recorded.
Bear in mind that atime is not always updated (depends on the file system mount options).
If you want to restrict the find to just files, then you can do:
find . -atime -30 -a -type f -print0 | xargs -0 ls -lud
Last access doesn't log the user that accessed the file.
find . -atime -30 -exec stat {} +
will give you all the info you can get.
If you don't have GNU find or stat, try what Petesh suggests.