Home > Article > Operation and Maintenance > What is the use of linux touch command
In Linux, the touch command is used to modify the time attributes of a file or directory, including access time and change time. The syntax format is "touch [option][file or directory...]". When using the touch command, if the specified file does not exist, the system will create a new blank file.
#The operating environment of this tutorial: Red Hat Enterprise Linux 6.1 system, Dell G3 computer.
Detailed explanation of touch command
1. Command function
Linux touch command is used to modify files Or the time attributes of the directory, including access time and change time.
2. Syntax format
touch [option][文件或目录…]
option description:
a Change the file reading time record.
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, reserved for compatibility with other unix systems.
r Use the time record of the reference file, which has the same effect as --file.
d To set the time and date, you can use various formats.
t Set the time record of the file, the format is the same as the date command.
--no-create will not create a new file.
--help lists the command format.
--version List version information.
3. Parameter option description
No option: If the file does not exist, create a new empty file. Access time, modify time and change time are all the current time; if the file exists, all three timestamps will be modified to the current time
Note: The change time has changed and became the current time.
The time format of this option is [[CC]YY]MMDDhhmm[.ss]
$ touch file #创建一个名为“file”的新的空白文件Related recommendations: "
Linux Video Tutorial"
The above is the detailed content of What is the use of linux touch command. For more information, please follow other related articles on the PHP Chinese website!