LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-02-2007, 12:08 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 436

Rep: Reputation: 33
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.

Thanks.
 
Old 08-02-2007, 12:18 PM   #2
Cichlid
Member
 
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.

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

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

Original Poster
Rep: Reputation: 33
Thanks but I already checked this out and I can't figure out the correct systax.
 
Old 08-02-2007, 12:43 PM   #4
pwc101
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:

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

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

Rep: Reputation: 0
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
 
Old 08-02-2007, 01:04 PM   #6
The_JinJ
Member
 
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
 
  


Reply


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 06:30 PM
find command brazilian_user Linux - General 1 09-12-2006 10:50 AM
find command DotHQ Red Hat 3 04-24-2006 07:02 AM
help with the find command clockworks Linux - Software 2 02-17-2004 05:24 PM
find command palmmjsg23 Linux - General 9 01-30-2004 11:45 PM


All times are GMT -5. The time now is 11:08 AM.

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