Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Linux Tutorials: Find Command Examples and Use scnario

rajeshkumar created the topic: Find Linux Command Collection
Find files modified in the last 48 hours, and in current folder and one level below
I believe the correct command is `find -maxdepth 2 -type f -mtime -2
• maxdepth: will tell find to only search in the current folder
• type: will tell find to only list files and not directories
• mtime: will tell find to only list the files modified in the last 24 hours

To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories:
find /directory_path -mtime -1 –print

To find all files with regular file types only, and modified in the last 24 hours (last full day) in current directory and its sub-directories:
find /directory_path -type f -mtime -1 –print
find . -type f -mtime -1 –print

To find all files that are modified today only (since start of day only, i.e. 12 am), in current directory and its sub-directories:
touch -t `date +%m%d0000` /tmp/$$
find /tmefndr/oravl01 -type f -newer /tmp/$$
rm /tmp/$$
The first command can be modified to specify other date and time, so that the commands will return all files that have changed since that particular date and time.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x