Linux File time

Source: Internet
Author: User
The time of the Linux sketch file is frequently asked about the document time during interviews with relevant Linux posts. Linux documents generally have three types of time: Accesstime-atime (access time), Modificationtime-mtime (content modification time), status-ctime (status time) w...
The time of the Linux sketch file is frequently asked about the document time during interviews with relevant Linux posts.
Linux documents are generally divided into three types of time: Access time-atime (Access time ),
Modification time-mtime (content Modification time), status-ctime (status time) www.2cto.com
Mtime can be displayed through the ls-l command, indicating the last modification time of the document content. Atime can be displayed through the ls-lu command, indicating the last time the document was accessed. Ctime can be displayed through the ls-lc command, indicating the last modification time of the document attribute. The following example uses Ubuntu 10.04.4 as the operating platform: ------------------------------------------------------------------------------ Jacob @ server01 :~ /Test $ date # display the current time as 09:29:35 Tue Dec 4 CST 2012 Jacob @ server01 :~ /Test $ touch test.txt blank file test.txt Jacob @ server01 :~ /Test $ ls-l # check whether the file mtime is-rw-r -- 1 Jacob 0 2012-12-04 test.txt Jacob @ server01 :~ /Test $ ls-lu # check whether the atime file is-rw-r -- 1 Jacob 0 2012-12-04 test.txt Jacob @ server01 :~ /Test $ ls-lc # view the file ctime as-rw-r -- 1 Jacob 0 2012-12-04 test.txt description: generally, all time is the initial time when the file is created. ---------------------------------------------------------------------------- Jacob @ server01 :~ /Test $ date # view the current time as 09:31:10 Tue Dec 4 CST 2012 Jacob @ server01 :~ /Test $ echo "abc"> test.txt # Modify the file content to abc Jacob @ server01 :~ /Test $ ls-l # view the file mtime as-rw-r -- 1 Jacob 0 2012-12-04 test.txt Jacob @ server01 :~ /Test $ ls-lc # view the file ctime at. when the file content is modified, file attribute changed-rw-r -- 1 Jacob 4 test.txt Jacob @ server01 :~ /Test $ ls-lu-rw-r -- 1 Jacob 4 test.txt # view the file atime at Jacob @ server01 :~ /Test $ date # view the current time as 09:33:44 Tue Dec 4 CST 2012 Jacob @ server01 :~ /Test $ chmod a + x test.txt # Modify file attributes Jacob @ server01 :~ /Test $ ls-l-rwxr-xr-x 1 Jacob 4 test.txt # view the file mtime as Jacob @ server01 :~ /Test $ ls-lu-rwxr-xr-x 1 Jacob 4 test.txt # view the file atime as Jacob @ server01 :~ /Test $ ls-lc-rwxr-xr-x 1 Jacob 4 test.txt # check that the file ctime is 90: 33 then Jacob @ server01 :~ /Test $ date # view the current time as 90: 35 Tue Dec 4 09:35:03 CST 2012 Jacob @ server01 :~ /Test $ cat test.txt # view the content of the access file abc Jacob @ server01 :~ /Test $ ls-l # check whether the file mtime is-rwxr-xr-x 1 Jacob 4 2012-12-04 test.txt Jacob @ server01 :~ /Test $ ls-lu-rwxr-xr-x 1 Jacob 4 test.txt # view the file atime as Jacob @ server01 :~ /Test $ ls-lc-rwxr-xr-x 1 Jacob 4 test.txt # view the file ctime
Related Article

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.