In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use the touch command in linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
In linux, the touch command is used to modify the time attributes of a file or directory, including access time and change time, with the syntax format "touch [option] [file or directory...]" . When using the touch command, a new blank file is created if the specified file does not exist.
The operating environment of this tutorial: Red Hat Enterprise Linux 6.1 system, Dell G3 computer.
Detailed explanation of touch command
1. Command function
The Linux touch command is used to modify the time properties of a file or directory, including access time and change time.
2. Grammar format
Touch [option] [file or directory...]
Option description:
A change the reading time record of the file.
M change the modification time record of the file.
C if the destination file does not exist, no new file will be created. It has the same effect as-- no-create.
F is not used and is reserved for compatibility with other unix systems.
R use the time record of the reference file, which is the same as-- file.
D set the time and date, you can use a variety of different formats.
T sets the time record of the file in the same format as the date instruction.
-- no-create will not create new files.
-- help lists instruction formats.
-- version lists version messages.
3. Description of parameter options
No option: if the file does not exist, create a new empty file with access time,modify time and change time as the current time; if the file exists, modify all three timestamps to the current time
-a: modify only the access time of the file
Note: after the access time is modified, the change time is also modified (because the state has changed).
-m: modify only the modify time of the file
Note: after the modify time is modified, the change time is also modified (because the state has changed).
-c: do not create files that do not exist (when multiple files are manipulated after touch, files that do not exist will not be created)
-d: use the specified date time instead of the current time, and you can use a variety of different formats.
-t: change the time to the date specified by the parameter, for example: 07081556 represents 15:56 on July 8th
Note: the change time has changed to the current time.
The time format of this option is [[CC] YY] MMDDhhmm [.ss]
-r file: updates the file's timestamp (access,modify) with the specified file file's timestamp (access,modify)
Note: the change time has changed to the current time.
Note: when using the directive "touch", if the specified file does not exist, a new blank file will be created. For example, in the current directory, use this directive to create a blank file "file" and enter the following command:
$touch file # create a new blank file called "file". This is the end of the article on "how to use touch commands in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.