Linux modification file creation time

  

touch [-acfm][-r reference-file] [--file=reference-file][-t MMDDhhmm[[CC]YY][.ss]][-d time] [--date=time] [--time={atime,access,use,mtime,modify}][--no-create] [--help] [--version]file1 [file2 ...] Description: The touch command changes the time record of the file. Ls -l can display the time record of the file. Parameters: a Change the read time record of the file. m Change the modification time record of the file. c If the destination file does not exist, a new file will not be created. Same effect as –no-create. f Not used, is reserved for compatibility with other unix systems. r Use the time record of the reference file, which has the same effect as –file. d Set the time and date, you can use a variety of different formats. t Set the time record of the file in the same format as the date command. –no-create will not create a new file. –help Lists the instruction format. –version lists the version messages.

Example: The easiest way to use, change the time of the file to the current time. If the file does not exist, the system will create a new file. Touch filetouch file1 file2

Change the time record of file to 16:8 on May 1st. The format of 2011 time can refer to the date command. At least MMDDHHmm is required, which is the month and day. Touch -c -t 05011608 filetouch -c -t 050116082011 file changes the time record of file to be the same as referencefile. Touch -r referencefile file changes the time record of file to 16:8 on May 1. AD 2011 can use am, pm or 24 hour format, and the date can use other formats such as 1 May 2011. Touch -d and date -s are used in the same way. If no date is specified, the default is system date touch -d 16:08 filetouch -d “16:08″ filetouch -d “4:08pm” file

If no time is specified, the default is 00:00 :00touch -d 20110501 filetouch -d “05/01/2011″ filetouch -d “20110511” filetouch -d “4:08pm 05/01/2011″ filetouch -d “20110501 16:08″ filetouch -d “20110501 16:08:00″ file

Copyright © Windows knowledge All Rights Reserved