File time attributes and Touch commands for Linux systems

Source: Internet
Author: User
Tags config touch touch command linux

The Linux file has three time attributes:

1) Mtime: file content Last modified time

2) CTime: File state changed time, such as permissions, properties were changed

3) Atime: File content is accessed time, such as cat,less, etc.

By default, LS displays the mtime of the file, which is the last time the file content was modified, and if you need to see the other two times, you can add the--time parameter as follows:

# ls-l/etc/man.config   
-rw-r--r--. 1 root 4940 Feb 2013/etc/man.config  
# ls-l--time Ctime/etc/man . config   
-rw-r--r--. 1 root root 4940 Nov  5 20:14/etc/man.config  
# ls-l--time atime/etc/man.config   
-rw- R--r--. 1 root 4940 Dec 03:50/etc/man.config

The touch command can modify the time of the file, and its usage is as follows:

If no date is specified, the default is the system date  
touch-d 18:03 file   
touch-d "18:03" file   
touch-d "6:03pm" file  
       
if no time is specified, the default is 00:00:00  
touch-d 20000506 file   
touch-d "05/06/2000" file touch-d "   
20000506" file  
touch-d "6:03pm 0 5/06/2000 "File   
touch-d" 20000506 18:03 "file   
touch-d" 20000506 18:03:00 "file

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.