1837365 Members
3288 Online
110116 Solutions
New Discussion

file access date

 
Bryan D. Quinn
Respected Contributor

file access date

I feel that this question has probably been asked here before, but I was unable to find anything similar while searching the forum. So, I will ask.

I have a need to find what file was accessed at 01:52 on November 23 2003, on one of my boxes. How can I go about doing that? Any ideas would be greatly appreciated.

Thanks,
-Bryan
8 REPLIES 8
Pete Randall
Outstanding Contributor

Re: file access date

Bryan,

The -u option of the ls command will give you last accessed date. Just grep for your desired time:

"ls -u /dir |grep 'November 23'"


Pete

Pete
Bryan D. Quinn
Respected Contributor

Re: file access date

Thanks Pete,

I was looking for something to do a recursive search through the entire system, starting at /.

I should have had a little more detail in my question.

-Bryan
Graham Cameron_1
Honored Contributor

Re: file access date

Don't think find -atime has low enough granularity, so how about

ls -lut / |grep "Nov 23 01:52"

Trouble is, that will only give you the file name(s), not locations, so you'll then need to do a 2nd pass with find to locate the file(s).

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Jean-Louis Phelix
Honored Contributor

Re: file access date

Hi,

# touch -t 0311230151 /tmp/before
# touch -t 0311230153 /tmp/after
# find / \( -newer /tmp/before -a ! -newer /tmp/before)

Regards.
It works for me (© Bill McNAMARA ...)
john korterman
Honored Contributor

Re: file access date

Hi,
you can try something like this:

find -type f -exec ls -lu {} \;| grep "Nov 23 01:52"

regards,
John K.
it would be nice if you always got a second chance
Jean-Louis Phelix
Honored Contributor

Re: file access date

Ooops ... missing \)

# touch -t 0311230151 /tmp/before
# touch -t 0311230153 /tmp/after
# find / \( -newer /tmp/before -a ! -newer /tmp/before \)

This will work even for old timeframes.

Regards.
It works for me (© Bill McNAMARA ...)
Jean-Louis Phelix
Honored Contributor

Re: file access date

dhfgblsjkdf sdvbsdfb !!!

# touch -t 0311230151 /tmp/before
# touch -t 0311230153 /tmp/after
# find / \( -newer /tmp/before -a ! -newer /tmp/after \)

please no points for these tipos ...

Regards
It works for me (© Bill McNAMARA ...)
Michael Schulte zur Sur
Honored Contributor

Re: file access date

Hi,

I assume, by access you mean update.

find / -exec ls -l "{}" ";" | grep "Nov 23 2003"

greetings,

Michael