Learn a little more (ix)--Use the touch command to create a file of a specified time

Source: Internet
Author: User
Tags touch command

before referring to the Find command , the-newer , -anewer, and -cnewer parameters can be used to find files in a time period. But often we do not have two of the exact time node files that we want to use, which requires the use of the Touch command to create the specified atime , mtime file.

    ( 1 -t Span style= "text-indent:37px;font-family: ' The song Body '; > parameters: Specify the file atime and mtime 1970 year Span style= "TEXT-INDENT:37PX;" >1 month 1 Span style= "text-indent:37px;font-family: ' The song Body '; The number of milliseconds from the day to the specified date, or you can use the date directly in the format [[CC]YY]MMDDHHMM[.SS]

[Email protected] ~]# touch-t 201003141036.30 oldfile

Note that the time here can also be quoted with quotes, i.e.:

[Email protected] ~]# touch-t "201003141036.30" Oldfile

(2)-D parameter: the same as the-T parameter, specify the file atime and mtime, just use the format slightly different, use a string form to specify the time:

[[email protected] ~]# touch-d "20020306"

[[email protected] ~]# touch-d "20020304 12:38"

(3)-r parameter: use atime and mtime of other files as Atime and mtime for This file :

[Email protected] ~]# touch-r oldfile newfile

(4)-a parameter: Only modify the Atime , the time setting does not affect the mtime , combined with -D or -T or -R use:

[Email protected] ~]# touch-a-t 201003141036.30 oldfile

[Email protected] ~]# touch-r oldfile newfile-a

(5)-M parameter: Only modify the Mtime, the time setting does not affect the Atime , with the-D or -t or -R use:

[Email protected] ~]# touch-m-t 201003141036.30 oldfile

[Email protected] ~]# touch-r oldfile newfile-m

Note:touch does not have relevant parameters to specify the file CTime, that is, the ctime of the newly created file can only be the current time.

This article is from the "barrel of fake dog excrement" blog, please be sure to keep this source http://xitongjiagoushi.blog.51cto.com/9975742/1632840

Learn a little more (ix)--Use the touch command to create a file of a specified time

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.