Linux touch command parameter modification file timestamp

Source: Internet
Author: User
Tags touch command
In linux, touch command parameters are not commonly used. they may be used when you use make to modify the file timestamp or create a new file that does not exist. The following are touch command parameters in linux.

In linux, touch command parameters are not commonly used. they may be used when you use make to modify the file timestamp or create a new file that does not exist, the following describes how to use the touch command parameters in linux:

Touch [-acm] [-r ref_file (reference file) |-t time (time value)] file (file name)

Example:

Touch file1.txt update file1.txt access and modification time

Touch-c file1.txt if file1.txt does not exist, no file is created

Touch-r ref_file file1.txt updates file1.txt with the same timestamp as ref + file

Touch-t 0811142234.50 file1.txt: the time when the file is set to be incorrect is, January 1, November 14.

-

Modify the file access time.

-C

Do not create file.

-M

Modify the file modification time

-R ref_file

Use the corresponding timestamp value of the ref_file object as the new timestamp value of the specified file.

-T time

Use the specified time value time as the new value of the corresponding time stamp of the specified file. the time here is defined as the following decimal number:

[[CC] YY] MMDDhhmm [. SS]

Here, CC is the first two in the number of years, that is, the number of centuries. YY is the last two in the number of years, that is, the number of years in a century. if the CC value is not given, the touch command parameter in linux limits the number of years CCYY to within 1969--2068. MM indicates the number of months. DD indicates the number of years CCYY is limited. MM indicates the number of months, DD indicates the number of days, hh indicates the number of hours (when), mm indicates the number of minutes, and SS indicates the number of seconds. the second is set to 0--61, which can process leap seconds. the time composed of these numbers is a time in the time zone specified by the environment variable TZ. due to system restrictions, the time earlier than January 1, January 1, 1970 is incorrect.

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.