In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to modify the file timestamp by Linux". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Linux how to modify the file timestamp" it!
The touch command in the Linux system can not only create the file, but also modify the file timestamp. If you want to modify the file time of the Linux, you can use the touch command to operate.
In the figure above, access, modify and change are access time, modification time and change time, respectively, that is, the timestamp of the file.
1. Command format:
Touch [options]... File name...
2. Command parameters:
-an or-time=atime or-time=access or-time=use only changes the access time.
-c or-no-create does not establish any documentation.
-d uses the specified date time instead of the current time.
-f this parameter is ignored and not processed, and is only responsible for resolving the compatibility issue of the BSD version of the touch directive.
-m or-time=mtime or-time=modify only changes the time of change.
-r set the date and time of the specified document or directory to the same date and time as the reference document or directory.
-t uses the specified date time instead of the current time.
3. Command function:
The touch command parameter changes the date time of the document or directory, including the access time and the change time.
4. Use examples:
Example 1: create a file that does not exist
Command:
Touch test1.txt test2.txt output:
[root@localhost test] # touch test1.txt test2.txt [root@localhost test] # ll-rw-r--r--. 1root root 0 May 18 11:11 test1.txt-rw-r--r--.1 root root 0 May 18 11:11 test2.txt if test3.txt does not exist, do not create the file [root@localhost test] # touch-c test3.txt [root@localhost test] # ll-rw-r--r--. 1root root 0 May 18 11:11 test1.txt-rw-r--r--.1 root root 0 May 18 11:11 test2.txt instance 2: the time for updating test.txt is the same as the test2.txt timestamp
Command:
Touch-r test.txt test2.txt output:
[root@localhost test] # touch test.txt [root@localhost test] # touch-r test.txt test2.txt [root@localhost test] # ll total 0-rw-r--r--. 1 root root 0 May 18 11:11 test1.txt-rw-r--r--. 1 root root 0 May 18 11:22 test2.txt-rw-r--r--.1 root root 0 May 18 11:22 test.txt instance 3: timestamp of the configuration file
Command:
Touch-t 201605171210.20 test.txt output:
[root@localhost test] # ll-rw-r--r--. 1root root 0 May 18 11:11 test1.txt-rw-r--r--.1 root root 0 May 18 11:22 test2.txt-rw-r--r--. 1 root root 0 May 18 11:22 test.txt [root@localhost test] # touch-t 201605171210.20 test.txt [root@localhost test] # ll-rw-r--r--. 1 rootroot 0 May 18 11:11 test1.txt-rw-r--r--.1 rootroot 0 May 18 11:22 test2.txt-rw-r--r--.1 rootroot 0 May 17 12:10 test.txt description:
-t time uses the specified time value time as the new value for the corresponding timestamp of the specified file. the time here is specified as a decimal number in the following form:
[[CC] YY] MMDDhhmm [.SS]
Here, CC is the top two of the years, that is, "centuries". 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, touch will limit the number of years CCYY to 1969 CCYY 2068. MM is the number of months, DD is the day, the number of years CCYY is within 1969Muth2068. MM is the number of months, DD is the number of days, hh is the number of hours (points), mm is the number of minutes, SS is the number of seconds This can handle leap seconds. The time composed of these numbers is one of the time zones specified by the environment variable TZ. Due to system limitations, a time earlier than January 1, 1970 is incorrect.
At this point, I believe that everyone on the "Linux how to modify the file timestamp" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.