LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-17-2008, 03:10 AM   #1
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
Help in find command


Hi all,


When I try to find the files which are a day old, am using the following find command.

Code:
find /directory -ctime -1
I got the output as

Code:
/directory
/directory/findoutfile
I just want the files only of 1 day old and not the directory. How can i do it ?

Thanks
 
Old 09-17-2008, 03:48 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
"man" is your friend. Enter "man find" and look at the "-type" test.

Last edited by pixellany; 09-17-2008 at 02:27 PM.
 
Old 09-17-2008, 04:04 AM   #3
bob_man_uk
Member
 
Registered: Jul 2003
Location: Malta
Distribution: Ubuntu/Windows/Mac
Posts: 83

Rep: Reputation: 16
when you say you want to show the files not the directory, you want to show just the file on its own IE instad of /directory/file just file or stop the first /directory being listed?
 
Old 09-17-2008, 04:07 AM   #4
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
I want to stop the first /directory being listed
 
Old 09-17-2008, 04:09 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by ZAMO View Post
I want to stop the first /directory being listed
And you have, of course, already tried the -type test I suggested.....
 
Old 09-17-2008, 04:43 AM   #6
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
Thank You Pixellary,

I got it

Code:
find /directory -ctime -1 -type f
 
Old 09-17-2008, 09:16 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Just FYI

Three fields in the inode structure contain the last access, change, and modification times: atime, ctime, and mtime. The atime field is updated each time the pointer to the file's data blocks is followed and the file's data is read. The mtime field is updated each time the file's data changes. The ctime field is updated each time the file's inode changes. The ctime is not creation time; there is no way under standard Unix to find a file's creation time.

Note the last sentence there(!)
 
  


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 On
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 and mv command nirmit Linux - Newbie 2 06-27-2008 05:45 AM
Find Command Need Help swamprat Linux - Newbie 5 08-02-2007 12:04 PM
Find command ? HOw? ZAMO Linux - Software 3 07-03-2007 06:57 AM
Best Find Command ckoniecny Linux - General 16 02-15-2006 11:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:03 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
Open Source Consulting | Domain Registration