Find the answer to your Linux question:
Results 1 to 7 of 7
The man time shows: -ctime n Files status was last changed n*24 hours ago. See the comments for -atime to understand how rounding affects the interpreta- tion of file status ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    4

    Question find command ctime vs. mtime vs. creation time


    The man time shows:

    -ctime n
    Files status was last changed n*24 hours ago. See the comments for -atime to understand how rounding affects the interpreta-
    tion of file status change times.


    -mtime n
    Files data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation
    of file modification times.

    Is there a difference between "changed" vs. "modified"? Is a data change also a status change? I am looking for a way to find files based on creation time. Does anyone know if there is such?

  2. #2
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    hope this solution works out for you

    create a file using the touch command and assign the file the date from which date you want to search a file.
    now excecute 'find' cmd with newer option
    ex: find <location> -newer <file created with touch>

    this would list all files from the date specified with touch cmd.

  3. #3
    Just Joined!
    Join Date
    Apr 2009
    Posts
    4

    Question assign the file the date

    Thanks for you reply. I don't know how to, "assign the file the date." Could you please show me the command?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    when ever you want to know how to use a commnad refer to the man pages. It's really very simple. The touch commnad has a '-t' option which can be used to assign a partcular date to a file.
    Syantax : touch -t [[CC]YY]MMDDhhmm[.ss]
    for example to give a file a date of 7/04/04
    simple do this
    #touch -t 20040407 filename.

  6. #5
    Just Joined!
    Join Date
    Apr 2009
    Posts
    4

    Smile Thanks

    Thank you very much, this is a perfect solution to my problem!

  7. #6
    Linux Newbie tetsujin's Avatar
    Join Date
    Oct 2008
    Posts
    117
    Quote Originally Posted by lfridkis View Post
    The man time shows:

    -ctime n
    Files status was last changed n*24 hours ago. See the comments for -atime to understand how rounding affects the interpreta-
    tion of file status change times.


    -mtime n
    Files data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation
    of file modification times.

    Is there a difference between "changed" vs. "modified"? Is a data change also a status change? I am looking for a way to find files based on creation time. Does anyone know if there is such?
    I have to admit I didn't know the answer to this myself... I tried a Google search and the answer I came up with is this:

    ctime is the last time the file's inode was changed: that would be, for instance, the file's size, permissions, etc. I don't know if it includes updates to the atime... (I would guess not) But it does include modifications to the file's data, I guess.

    mtime is the last time the file's contents were modified - the last time somebody did a write() to the file (or certain types of seek(), truncation, etc.)

    ctime changes any time mtime changes, but there are some operations that will change ctime but not mtime.

  8. #7
    Just Joined!
    Join Date
    Apr 2009
    Posts
    4

    Smile

    thank you!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •