![]() ![]() ![]() The following touch command example will update the time-stamp of file a.txt with the time-stamp of tgs.txt file. You can also take a file as a reference, and update the time for other files, so that both file will hold the same time. Copy the Time-stamp from Another File using -r The system records file times when applications create, access, and write to files. You can also use a string to change the timeĪnother example: $ touch -d " 12:12:12.000000000 +0530" tgs.txtįor developers, touch command will be really helpful when you are working with Makefiles 5. A file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 A.M. Size: 3 Blocks: 8 IO Block: 4096 regular file Verify the above change using stat command: $ stat tgs.txt It is not possible to set the date beyond January 18, 2038.įor example: $ touch -a -m -t 203801181205.09 tgs.txt If the value of the YY is between 00 and 37, the value of the CC digits is assumed to be 20. If the value of the YY is between 70 and 99, the value of the CC digits is assumed to be 19. YY – Specifies the last two digits of the year.CC – Specifies the first two digits of the year.The format for specifying -t is YY]MMDDhhmm Instead of taking the current time-stamp, you can explicitly specify the time using -t and -d options. Explicitly Setting Access and Modification time using -t and -d NOTE: It is not possible to change the ctime using touch command 4. The above method can be used to change the mtime of all obj files, when using make utility. You can change the modification time of a file using -m option. By access, it means if you used cat, vim, less, or some other tool to read or display the content of the file. ![]() This timestamp tells you when was the last time the file was accessed. Size: 0 Blocks: 0 IO Block: 4096 regular empty fileĭevice: 801h/2049d Inode: 394283 Links: 1Īccess: (0644/-rw-r-r-) Uid: ( 1000/lakshmanan) Gid: ( 1000/lakshmanan)Ĭhange: 23:58:21.663514407 +0530 $ touch -a tgs.txtĪfter the above touch command (Please note that the access time is changed): $ stat tgs.txtĬhange: 00:08:23.559514525 +0530 3. Any file in Linux has these three timestamps typically: atime access time mtime modify time ctime change time atime atime stands for access time. By default it will take the current system time and update the atime field.īefore touch command is executed: $ stat tgs.txt We can change the access time of a file using -a option. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |