Linux Ctime/mtime/atime

Source: Internet
Author: User

Linux uses Ctime/mtime/atime to mark document time,


CTIME:C does not represent create but the change meaning, such as the modification of the contents of the file changes will be changed CTime

Mtime:m is modify meaning, and ctime the only difference is that permission modification has no effect on it

Atime:a is the time that a file is accessed, such as when you open a file, even if there are no changes to it, it will have an impact on the time.


In order to facilitate learning to write a script, the main function is to display the file three kinds of time, you can choose a file to do the following, see the changes in the status of the file, to deepen the understanding of the text time.

A) touch,

b) Turn it off without modification,

c) Open the changes and then close to see the current status of the file.

#!/usr/bin/env pythonimport subprocessimport argparseimport os.path,  timedef script (cmd):    print cmd    Subprocess.call (cmd, shell=true) if __name__  = = "__main__":    parser = Argparse. Argumentparser ()    parser.add_argument ("-F",  "--file",  help= "The directory for the file")    args = Parser.parse_args ()    if args.file:        print "Start Script"        print "CTime (change Time   ):%s"% Time.ctime (Os.path.getctime (args.file))        Print "Mtime (last Modified):%s"% Time.ctime (Os.path.getmtime (args.file))        print "Atime (   Access time):%s"% Time.ctime (Os.path.getatime (args.file))        print "End Script"    else:        parser.print_help ()



Linux Ctime/mtime/atime

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.