File Times (mtime, ctime, atime)

Posted on Feb 21, 2009

Unlike Windiws, you can not determine when a file was created. Instead, you can only determine three things:

  1. atime – the time in which a file was accessed. This includes viewing the contents of the file or executinng a shell script.
    
    
        cat example\_file
        
    
  2. ctime – the time in which a file’s inode (owner, group, and permissions) and when the file’s contents were last changed. To view the files ctime with the ls command use the -lc flags.
    
    
        chown root:root example\_file
        
    
  3. mtime – is the time in which a files conntents have been modified. This differs from the ctime as it will not reflect when the permissions were modified.
    
    
        echo "Hello!" >> example\_file