The time stamp of the Touch command parameter modification file in Linux (GO)

Source: Internet
Author: User
Tags touch command

In Linux, the touch command parameters are not commonly used, usually used when make can be used to modify the file timestamp, or create a new file that does not exist, the following is the use of the Touch command parameters in Linux:

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

Example

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

Touch-c file1.txt If File1.txt does not exist, the file is not created

Touch-r ref_file file1.txt update file1.txt timestamp and Ref+file same

Touch-t 0811142234.50 File1.txt The time to set the file is November 14, 08 22:34 40 seconds

-A

Modifies the file's access time.

-C

File is not created.

-M

Modify the file's modification time

-R Ref_file

The reference file Ref_file the value of the corresponding timestamp as the new value for the file timestamp of the specified document.

-T time

Uses the specified time value as a new value for the corresponding timestamp for the specified file. The time specified here is a decimal number in the following form:

[[Cc]yy] mmddhhmm[. SS]

Here, CC is the first two digits of the number of years, that is, "century"; yy is the last two digits of the number of years, that is, the number of years in a century. If the value of CC is not given, then the Touch command parameter in Linux will limit the number of years Ccyy to 1969--2068. MM for the number of months, DD for the day will be the number of years Ccyy limited to 1969--2068 within. MM is the number of months, DD is the number of days, HH is the number of hours (several), MM is the number of minutes, SS is the number of seconds. The set range of seconds here is 0--61, which can handle leap seconds. These numbers consist of a time in the time zone specified by the environment variable TZ. Due to system limitations, the time earlier than January 1, 1970 was wrong.

The time stamp of the Touch command parameter modification file in Linux (GO)

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.