Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-02-2007, 11:08 AM   #1
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 473

Rep: Reputation: 34
Unhappy Find Command Need Help

I need some help using the find command.

I checked out the man pages...confusing for a newbie.

I would like to search the system and get a list of all files which were changed within the past 20 day.

I tried a few things but the syntax didn't work.

Any help will be appreciated.

Old 08-02-2007, 11:18 AM   #2
Registered: Jan 2002
Location: Montreal
Distribution: Ubuntu 8.10
Posts: 178

Rep: Reputation: 30
Below is an example of what you can find by doing a Google search. Even though is shows the man page, which can be hard to understand, a lot of time you can find examples to work with.

Good luck
Old 08-02-2007, 11:36 AM   #3
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 473

Original Poster
Rep: Reputation: 34
Thanks but I already checked this out and I can't figure out the correct systax.
Old 08-02-2007, 11:43 AM   #4
Senior Member
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
What did you try? If you post what you've tried, and any error messages you got, people are more inclined to tell you where you've gone wrong.

The page below has an example of how to use find to search for things which have been modified within the last x number of days:

Hint: use your browser's find command to search for "time" in that page.
Old 08-02-2007, 11:43 AM   #5
Mostly Harmless
LQ Newbie
Registered: Aug 2007
Distribution: Slackware/Gentoo
Posts: 1

Rep: Reputation: 0
From the man page:
-mtime n
File's data was last modified n*24 hours ago.  See the comments for -atime to understand how rounding affects the interpretation of file modification times.

find $HOME -mtime 0
Search for files in your home directory which have been modified in the last twenty-four hours.  This command works  this  way  because the time since each file was last modified is divided by 24 hours and any remainder is discarded.  That means that to match -mtime 0, a file will have to have a modification in the past which is less than 24 hours ago.

I think this is the command you want: find /path/to/whatever -mtime 20
Old 08-02-2007, 12:04 PM   #6
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Rep: Reputation: 30
find . -mtime 0 # find files modified within the past 24 hours
find . -mtime -1 # find files modified within the past 24 hours
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago
find . -mmin +5 -mmin -10 # find files modifed between 6 and 9 minutes ago

So I guess you want:
find . -mtime -20


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
find command brazilian_user Linux - General 1 09-12-2006 09:50 AM
find command DotHQ Red Hat 3 04-24-2006 06:02 AM
help with the find command clockworks Linux - Software 2 02-17-2004 04:24 PM
find command palmmjsg23 Linux - General 9 01-30-2004 10:45 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration