LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 03-01-2006, 04:51 PM   #1
shmuck
LQ Newbie
 
Registered: Nov 2005
Posts: 11

Rep: Reputation: 0
Fedora 4, help with find command


Hey guys, how do you find all the files within a directory by a certain time?

I've read the "man find" thing over and over. I'm trying to find files that were last created or modified since midnight.

I've tried a bunch of different commands but nothing has gotten me very far.
 
Old 03-01-2006, 05:44 PM   #2
bushidozen
Member
 
Registered: Oct 2004
Posts: 215

Rep: Reputation: 30
This may not be the best way, but if you view the content of the directory as a list, and click the "Date Modified" tab, that might help you.

Also, using grep in combination with the ls command would probably work better for you.
 
Old 03-01-2006, 05:45 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Have you considered ls -lt? Perhaps piped into grep -r "Mar 1" (Or whatever month and day in which you're interested.)
 
Old 03-01-2006, 06:11 PM   #4
shmuck
LQ Newbie
 
Registered: Nov 2005
Posts: 11

Original Poster
Rep: Reputation: 0
I'll try those right now guys.

My teacher just said to use the find command. But he isnt the greatest guy around.
 
Old 03-01-2006, 10:45 PM   #5
sipsipi
Member
 
Registered: Dec 2005
Location: Chicago
Distribution: Fedora and Redhat
Posts: 86

Rep: Reputation: 15
find -mtime is what you are looking for if it's a modified file or
find -atime for last access time.
 
Old 03-02-2006, 08:50 PM   #6
ninjaz
Member
 
Registered: Aug 2003
Location: Michigan
Distribution: RHEL v.4, Debian
Posts: 82

Rep: Reputation: 15
Cant slocate do the same thing?
 
Old 03-02-2006, 09:03 PM   #7
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
sipsipi's suggestion will work fine. You may want to add the -daystart switch so that the time is measured from the beginning of today instead of 24 hours ago.
 
Old 03-07-2006, 02:18 PM   #8
shmuck
LQ Newbie
 
Registered: Nov 2005
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks a lot guys. I've figured everything out, but I just need to find out how find files that have been modified since I booted. Also, do you guys how I can change the system login message?
 
Old 03-07-2006, 07:47 PM   #9
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You can use the same find command as the one above - but for the value that mtime uses you can take the output from:
Code:
last -x | egrep '^reboot|shutdown'
The number at the end of the line, for example (2+02:59), is how much time has elapsed since the date/time printed for the reboot.

Also, have a look in the files /etc/issue (man issue) and /etc/motd (man motd) for the login messages.
 
Old 03-07-2006, 08:31 PM   #10
shmuck
LQ Newbie
 
Registered: Nov 2005
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks gil!

I stumbled across the motd file today so I've got the login message and banner figured out. Just have to do the boot time thing.

Thanks for all the help guys.
 
Old 03-08-2006, 10:12 PM   #11
sipsipi
Member
 
Registered: Dec 2005
Location: Chicago
Distribution: Fedora and Redhat
Posts: 86

Rep: Reputation: 15
In your response to "find files according to time" you put in

last -x | egrep '^reboot|shutdown'

What does the ^ mean that you put before "reboot"

also, what is the difference between grep and egrep?
 
Old 03-09-2006, 02:43 AM   #12
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
The '^' matches the start of the line, so it would match
reboot, or
shutdown, but not
Almost time for a reboot
The difference between grep and extended grep (egrep) is in the regular expressions that they support. I couldn't make the '|' (which is used to 'or' 2 patterns) work with grep unless I used -E, which means the same as using egrep.
 
  


Reply



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 slack66 Slackware 8 03-14-2005 03:17 PM
find command palmmjsg23 Linux - General 9 01-30-2004 10:45 PM
Find command?? mylo2003 Linux - Newbie 3 08-07-2003 02:27 PM
Find Command chrisk5527 Linux - General 3 04-19-2003 06:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 11:25 PM.

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
Open Source Consulting | Domain Registration