list of files changed from certain date

Alicelinux

New Member
Joined
Sep 23, 2018
Messages
23
Reaction score
0
Credits
0
I'm using red hat linux, is it able to get the list of changed files and newly created files under /etc folder from Aug.21.2018 untill now. I'm fine if two command, one for created files and the other for changed files. any idea? thanks
 


Dimitris

New Member
Joined
Apr 7, 2018
Messages
23
Reaction score
22
Credits
0
There could be a command for that exact purpose but I know none. You could try, and this is kinda overboard I know, "dry run" something like touch and to see differences in dates by piping the result of the command into a txt... Damn, that's too much, there is probably someone who can actually help :p
 

atanere

Well-Known Member
Joined
Apr 6, 2017
Messages
2,628
Reaction score
2,781
Credits
41
See my reply to you here. The find command will work better on this instead of deleted files. I doubt you can list deleted files, but I'm not certain.
 
OP
A

Alicelinux

New Member
Joined
Sep 23, 2018
Messages
23
Reaction score
0
Credits
0
find command can't list newly created files, but changed files can, so how to find newly created files (say the last ten days)
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,615
Reaction score
2,315
Credits
12,249
What about this?:
Code:
find -daystart /path/to/search -type f -ctime -10

That should find ALL files that were created or modified in the last 10 days.
 

atanere

Well-Known Member
Joined
Apr 6, 2017
Messages
2,628
Reaction score
2,781
Credits
41
What about this?:
Code:
find -daystart /path/to/search -type f -ctime -10

That should find ALL files that were created or modified in the last 10 days.
I get an error with the "-daystart" option, but without that it seems to work properly for me. :D

Cheers
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,615
Reaction score
2,315
Credits
12,249
In that case the -daystart option may have been removed from find. I have to admit, I haven't used -daystart with find for a long time, I just know of it's existence (or former existence).
I'm at work ATM and not anywhere near a Linux terminal...

The -daystart option would set the start time for the search to the start of the day for the first day of the search.
So if it's 3pm and you are searching for files that were modified in the last 10 days without the -daystart option - then find would only include files from 10 days ago time-stamped from 3pm onwards. Whereas with the -daystart option, find would show files from the start of the day from 10 days ago onwards, so you were guaranteed to get ALL files from the first day.

Incidentally, the reason I've used a negative value (-10) with -ctime is to get ALL files that were created/modified in the last 10 days.
If I used a positive value (e.g. 10, or +10) with -ctime, it would only show files that were created EXACTLY 10 days ago.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Latest posts

Top