LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Find Command Need Help (https://www.linuxquestions.org/questions/linux-newbie-8/find-command-need-help-574240/)

swamprat 08-02-2007 11:08 AM

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.

Thanks.

Cichlid 08-02-2007 11:18 AM

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.

http://www.computerhope.com/unix/ufind.htm

Good luck

swamprat 08-02-2007 11:36 AM

Thanks but I already checked this out and I can't figure out the correct systax.

pwc101 08-02-2007 11:43 AM

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:

http://www.hccfl.edu/pollock/Unix/FindCmd.htm

Hint: use your browser's find command to search for "time" in that page.

Mostly Harmless 08-02-2007 11:43 AM

From the man page:
Code:

-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

The_JinJ 08-02-2007 12:04 PM

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


All times are GMT -5. The time now is 12:30 PM.